OSC plugin should be using region/interface

This fixes the OSC plugin so that if region is specified or if the
interface is specified (public, internal, admin) then those will be
passed into the heat_client when instantiated.  Without this the
client will pick the endpoint for the first region returned instead of
the one specified.

Change-Id: I26775dcab05339f14bacf64e723eb3615616df5e
Closes-Bug: #1631383
This commit is contained in:
zhurong 2016-10-07 21:57:09 +08:00
parent 0171ea9ffe
commit dd541033b9
1 changed files with 14 additions and 4 deletions

View File

@ -51,8 +51,11 @@ def make_client(instance):
try:
# no glare_endpoint and we requested to store packages in glare
# check keystone catalog
glare_endpoint = \
instance.get_endpoint_for_service_type('artifact')
glare_endpoint = instance.get_endpoint_for_service_type(
'artifact',
region_name=instance._region_name,
interface=instance._interface
)
except Exception:
raise exc.CommandError(
"You set murano-packages-service to {}"
@ -68,8 +71,15 @@ def make_client(instance):
token=instance.auth_ref['token']['id'])
kwargs['artifacts_client'] = artifacts_client
client = application_catalog_client(
instance.get_configuration().get('murano_url'), **kwargs)
murano_endpoint = instance.get_configuration().get('murano_url')
if not murano_endpoint:
murano_endpoint = instance.get_endpoint_for_service_type(
'application-catalog',
region_name=instance._region_name,
interface=instance._interface
)
client = application_catalog_client(murano_endpoint, **kwargs)
return client