From 7f56f0a8c315d514fcbb6ae353a5cc83ce1a5c84 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Mon, 24 Feb 2014 12:17:49 -0700 Subject: [PATCH] Pretty print of endpoints for ambiguous error Pretty print the list of endpoints by region for ambigous endpoint error Change-Id: Ia99b6d46b1944db631fc4bd446aeae77abb08262 Closes-Bug: #1241177 --- cinderclient/service_catalog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cinderclient/service_catalog.py b/cinderclient/service_catalog.py index b43eaed6f..ce78b47be 100644 --- a/cinderclient/service_catalog.py +++ b/cinderclient/service_catalog.py @@ -79,7 +79,10 @@ class ServiceCatalog(object): if not matching_endpoints: raise cinderclient.exceptions.EndpointNotFound() elif len(matching_endpoints) > 1: - raise cinderclient.exceptions.AmbiguousEndpoints( - endpoints=matching_endpoints) + try: + eplist = [ep[attr] for ep in matching_endpoints] + except KeyError: + eplist = matching_endpoints + raise cinderclient.exceptions.AmbiguousEndpoints(endpoints=eplist) else: return matching_endpoints[0][endpoint_type]