From f66b0d57d123941c46a6c27721a513927a7c6490 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Sat, 30 Jul 2016 20:54:23 -0700 Subject: [PATCH] print endpoints using new keystoneauth catalog object cinderclient was assuming an identity v2 styled service catalog would always be returned (when using `cinder endpoints`). keystoneclient would return either a v2 or v3 styled catalog, whereas keystoneauth abstracts out the differences and handles them internally. the result is that there is no need to look for specific ['serviceCatalog'] or ['catalog'] keys in the dictionary returned from keystoneauth. it should be noted that perhaps cinderclient should deprecate the ability to list endpoints since that is mostly an identity and admin level operation, and likely an artifact from early openstack days, it should now be handled by openstackclient. further, it's not clear whether the command is meant to list all endpoints or just the endpoints in the user's token (which it does now). Change-Id: Ibfcccedee5baf43f5b5c517d37e3f046c8743078 Closes-Bug: 1608166 --- cinderclient/v1/shell.py | 2 +- cinderclient/v3/shell.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 21ee7476f..2c06e6708 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -655,7 +655,7 @@ def do_type_key(cs, args): def do_endpoints(cs, args): """Discovers endpoints registered by authentication service.""" catalog = cs.client.service_catalog.catalog - for e in catalog['serviceCatalog']: + for e in catalog: utils.print_dict(e['endpoints'][0], e['name']) diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 2f8900569..922e3f87d 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -1035,7 +1035,7 @@ def do_type_access_remove(cs, args): def do_endpoints(cs, args): """Discovers endpoints registered by authentication service.""" catalog = cs.client.service_catalog.catalog - for e in catalog['serviceCatalog']: + for e in catalog: utils.print_dict(e['endpoints'][0], e['name'])