[SOLVED] Update provider password in Automate methods


I’m looking for a way to update an Openstack provider password in a Automate methods.
To be more specific, the use case I try to achieved is using a service dialog to update both my Openstack user password in keystone and in VMDB.

To update my user password in Keystone, I successfullly use the Openstack API. But I’m stucked with the password in VMBD.

For MIQ, It’s seems to be not supported, for the moment, throught the API.
Via the MIQ API, I’ve find the change_password in the possible actions for a provider :

curl -k -u admin:smartvm -X GET -H "Accept: application/json" https://miq/api/providers/344|python -m json.tool
"actions": [
        "href": "https://miq/api/providers/344",
        "method": "post",
        "name": "change_password"
        "href": "https://miq/api/providers/344",
        "method": "post",
        "name": "edit"

So I’ve tried to use ths action in a POST call :

curl -k -u admin:smartvm -X POST -H 'Accept: application/json' -d '{
   "action" : "change_password",
   "resource" : {  
      "password": "test"
}' https://miq/api/providers/344
{"success":true,"message":"Change password requested for Physical Provider Test_Provider","task_id":"72298","task_href":"https://miq/api/tasks/72298","href":"https://miq/api/providers/344"}

So, MIQ created a task 72298 to update my password but when I display the output for this task, I find that the password update is not supported for Openstack providers:

curl -k -u admin:smartvm -X GET -H "Accept: application/json" https://miq/api/tasks/72298|python -m json.tool
"context_data": null,
"created_on": "2019-10-28T11:53:15Z",
"href": "https://miq/api/tasks/72298",
"id": "72298",
"identifier": null,
"message": "Change Password is not supported for OpenStack provider",
"miq_server_id": "1",
"name": "Changing the password for Physical Provider named 'Test_provider'",
"pct_complete": null,
"results": null,
"started_on": "2019-10-28T11:53:19Z",
"state": "Finished",
"status": "Error",
"updated_on": "2019-10-28T11:53:19Z",
"userid": "admin",
"zone": null


Does someone have any ideas to achieve that ?

Thanks !

Hi all,

I’ve finally found how to change the provider password through the API.

Simply by using the EDIT action as following :

require 'rest_client'
require 'json'
url = "https://#{hostname}/api/providers/#{provider.id}"
body = {
  :action            => "edit",
  :credentials       => {
    :userid     => provider.authentication_userid, # current provider userid from provider
    :password   => new_password, # new password form dialog
params = {
  :method => "POST",
  :url => url,
  :verify_ssl => false,
  :user => admin,
  :password => smartvm,
  :headers => {
    :content_type => "application/json",
    :accept => "application/json",
  :payload => body.to_json
response      = RestClient::Request.new(params).execute
results       = JSON.parse(response.to_str)

Thanks a lot !