From e2dad7d82c485d10fbd1d74e86bcf82a164ff3a8 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Thu, 26 Feb 2015 12:07:11 +1100 Subject: [PATCH] Allow handling multiple service_types If the same service_type was mentioned in the catalog more than once then only the last entry would be parsed and any possible other matches would be lost. This was something that novaclient used to do, and as we are pushing sessions as the way that clients should all work we need to maintain that compatibility. Change-Id: I6964515ed1975bce1998897abfc02a1ec36e2584 Closes-Bug: #1425766 --- keystoneclient/service_catalog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keystoneclient/service_catalog.py b/keystoneclient/service_catalog.py index e942685..143a6b7 100644 --- a/keystoneclient/service_catalog.py +++ b/keystoneclient/service_catalog.py @@ -127,7 +127,7 @@ class ServiceCatalog(object): if service_name != sn: continue - sc[st] = [] + endpoints = sc.setdefault(st, []) for endpoint in service.get('endpoints', []): if (endpoint_type and not @@ -136,7 +136,7 @@ class ServiceCatalog(object): if (region_name and region_name != self._get_endpoint_region(endpoint)): continue - sc[st].append(endpoint) + endpoints.append(endpoint) return sc