Update the Nova client creation

The current novaclient creation code passes in a url parameter which
isn't valid. This change updates the client creation and uses the same
code as Mistral does for it's own OpenStack actions.

Change-Id: Id72cefcb7a1bd9baf515dd95f389d206a3ccf01a
Closes-bug: #1665637
(cherry picked from commit b3282003f2)
This commit is contained in:
Dougal Matthews 2017-02-17 14:15:49 +00:00
parent 346461d51d
commit 8ff75ce0ad
1 changed files with 18 additions and 5 deletions

View File

@ -119,8 +119,21 @@ class TripleOAction(base.Action):
keystone_endpoint = keystone_utils.get_endpoint_for_project('keystone')
nova_endpoint = keystone_utils.get_endpoint_for_project('nova')
nc = nova_client(2, username=ctx.user_name, auth_token=ctx.auth_token,
auth_url=keystone_endpoint.url, url=nova_endpoint.url,
project_id=ctx.project_id)
nc.client.management_url = nova_endpoint.url
return nc
client = nova_client(
2,
username=None,
api_key=None,
service_type='compute',
auth_token=ctx.auth_token,
tenant_id=ctx.project_id,
region_name=keystone_endpoint.region,
auth_url=keystone_endpoint.url,
insecure=ctx.insecure
)
client.client.management_url = keystone_utils.format_url(
nova_endpoint.url,
{'tenant_id': ctx.project_id}
)
return client