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