From 7d90ea22b481e06f985c7d3f2844e2462715271c Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Wed, 27 Jul 2016 10:00:23 +0800 Subject: [PATCH] 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 --- zaqarclient/queues/cli.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zaqarclient/queues/cli.py b/zaqarclient/queues/cli.py index c2db59a3..4dcf2828 100644 --- a/zaqarclient/queues/cli.py +++ b/zaqarclient/queues/cli.py @@ -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 )