Update a provider instance

PUT method to update a provider instance configuration in the cluster.

Method URL Description
PUT https://host_name:port/platform/rest/hostfactory/providers/$instance_name Update a provider instance configuration detail. If a provider instance is under-used, the update function fails.
Remember:

If the provider plug-in is enabled, you can update an enabled or disabled provider instance.

If the provider plug-in is disabled, updating a disabled provider instance to enabled fails. However, you can update an enabled provider instance to disabled.

If the provider instance is enabled and the provider plug-in that is used by this provider instance is disabled, the provision host with this provider instance fails.

Prerequisites

You must be the cluster administrator, or your user account must be assigned the HF_ALL_PROVIDER_MANAGE permission.

Request

PUT https://host_name:port/platform/rest/hostfactory/providers/$instance_name
where instance_name identifies the provider instance.

Table 1. Request parameter
Parameter Type Required/Optional Description
hfcsrftoken string Optional CSRF token that is obtained with successful login.

If you use curl, the command might look like the following example:

curl --header -b /tmp/cookie --cacert /opt/ibm/spectrumcomputing/wlp/usr/shared/resources/security/cacert.pem --tlsv1.2 -X PUT https://myprimaryhost.example.com:9443/platform/rest/hostfactory/providers/$isntancename?hfcsrftoken=915ee7644f431e630dac68b9ab3e40bc -d '{"name": "ibmcloudgen2","enabled": 1, "scriptPath": "${HF_TOP}/${HF_VERSION}/providerplugins/ibmcloud2/scripts/"}'
This command takes a JSON request string to update a provider instance with the following sample configuration details by disable provider instance ibmcloudgen2inst:
{
   "name": "ibmcloudgen2inst",
   "enabled": 0,
   "plugin": "ibmcloudgen2",
   "confPath": "${HF_CONFDIR}/providers/ibmcloudgen2inst/",
   "workPath": "${HF_WORKDIR}/providers/ibmcloudgen2inst/",
   "logPath": "${HF_LOGDIR}/"
}

Response

The command returns to the updated hostProviders.json file at:
  • $EGO_CONFDIR/../../hostfactory/conf/providers/ on Linux®
  • %EGO_CONFDIR%\..\..\hostfactory\conf\providers\ on Windows
Status code Description
200 OK.
404 Not found.
500 Internal server error. Check the log files and look for hints in the API response body.