Merge "Respect region name when processing domain URL"
This commit is contained in:
@@ -455,6 +455,15 @@ class HTTPClient(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.warning("Failed to store token into keyring %s" % (e))
|
_logger.warning("Failed to store token into keyring %s" % (e))
|
||||||
|
|
||||||
|
def _process_management_url(self, region_name):
|
||||||
|
try:
|
||||||
|
self._management_url = self.auth_ref.service_catalog.url_for(
|
||||||
|
service_type='identity',
|
||||||
|
endpoint_type='admin',
|
||||||
|
region_name=region_name)
|
||||||
|
except exceptions.EndpointNotFound:
|
||||||
|
_logger.warning("Failed to retrieve management_url from token")
|
||||||
|
|
||||||
def process_token(self, region_name=None):
|
def process_token(self, region_name=None):
|
||||||
"""Extract and process information from the new auth_ref.
|
"""Extract and process information from the new auth_ref.
|
||||||
|
|
||||||
@@ -467,14 +476,7 @@ class HTTPClient(object):
|
|||||||
if not self.auth_ref.tenant_id:
|
if not self.auth_ref.tenant_id:
|
||||||
raise exceptions.AuthorizationFailure(
|
raise exceptions.AuthorizationFailure(
|
||||||
"Token didn't provide tenant_id")
|
"Token didn't provide tenant_id")
|
||||||
try:
|
self._process_management_url(region_name)
|
||||||
self._management_url = self.auth_ref.service_catalog.url_for(
|
|
||||||
service_type='identity',
|
|
||||||
endpoint_type='admin',
|
|
||||||
region_name=region_name or self.region_name)
|
|
||||||
except exceptions.EndpointNotFound:
|
|
||||||
_logger.warning("Failed to retrieve management_url from token")
|
|
||||||
|
|
||||||
self.project_name = self.auth_ref.tenant_name
|
self.project_name = self.auth_ref.tenant_name
|
||||||
self.project_id = self.auth_ref.tenant_id
|
self.project_id = self.auth_ref.tenant_id
|
||||||
|
|
||||||
|
@@ -117,8 +117,7 @@ class Client(httpclient.HTTPClient):
|
|||||||
if not self.auth_ref.domain_id:
|
if not self.auth_ref.domain_id:
|
||||||
raise exceptions.AuthorizationFailure(
|
raise exceptions.AuthorizationFailure(
|
||||||
"Token didn't provide domain_id")
|
"Token didn't provide domain_id")
|
||||||
if self.auth_ref.management_url:
|
self._process_management_url(kwargs.get('region_name'))
|
||||||
self._management_url = self.auth_ref.management_url[0]
|
|
||||||
self.domain_name = self.auth_ref.domain_name
|
self.domain_name = self.auth_ref.domain_name
|
||||||
self.domain_id = self.auth_ref.domain_id
|
self.domain_id = self.auth_ref.domain_id
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user