Merge "Using correct keyword for region in v3"

This commit is contained in:
Jenkins 2015-02-23 01:38:04 +00:00 committed by Gerrit Code Review
commit b61d6b6dbb
2 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,8 @@ class _Service(dict):
def add_endpoint(self, interface, url, region=None):
data = {'interface': interface,
'url': url,
'region': region}
'region': region,
'region_id': region}
self.setdefault('endpoints', []).append(data)
return data

View File

@ -49,6 +49,9 @@ class ServiceCatalog(object):
# to calls made to the service_catalog. Provide appropriate warning.
return self._region_name
def _get_endpoint_region(self, endpoint):
return endpoint.get('region_id') or endpoint.get('region')
@abc.abstractmethod
def get_token(self):
"""Fetch token details from service catalog.
@ -130,7 +133,8 @@ class ServiceCatalog(object):
if (endpoint_type and not
self._is_endpoint_type_match(endpoint, endpoint_type)):
continue
if region_name and region_name != endpoint.get('region'):
if (region_name and
region_name != self._get_endpoint_region(endpoint)):
continue
sc[st].append(endpoint)