Fix the attribute missing error

After the openstack client patch[1], the attribute "_url" and
"_auth_params" has been removed. We should use another way to get
the auth information.

[1]: https://review.openstack.org/#/c/329189/18

Change-Id: I2bf1c06370ba2917947b7807547ef46cd299b1dd
This commit is contained in:
wangxiyuan
2016-07-27 10:00:23 +08:00
parent fa1a86c846
commit 7d90ea22b4

View File

@@ -28,9 +28,12 @@ API_VERSIONS = {
"2": "zaqarclient.queues.v2.client.Client",
}
_MESSAGING_ENDPOINT = None
def make_client(instance):
"""Returns an queues service client."""
global _MESSAGING_ENDPOINT
version = instance._api_version[API_NAME]
try:
version = int(version)
@@ -42,14 +45,15 @@ def make_client(instance):
version,
API_VERSIONS)
if not instance._url:
instance._url = instance.get_endpoint_for_service_type(
# TODO(wangxiyuan): Use public attributes instead of private attributes.
if not _MESSAGING_ENDPOINT:
_MESSAGING_ENDPOINT = instance.get_endpoint_for_service_type(
API_NAME,
region_name=instance._region_name,
interface=instance._interface
)
auth_params = instance._auth_params
auth_params = instance.get_configuration()['auth']
auth_params.update({
"auth_token": instance.auth.get_token(instance.session),
"insecure": instance._insecure,
@@ -63,7 +67,7 @@ def make_client(instance):
LOG.debug('Instantiating queues service client: %s', queues_client)
return queues_client(
instance._url,
_MESSAGING_ENDPOINT,
version,
conf
)