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
This commit is contained in:
Steve Martinelli 2016-07-30 20:54:23 -07:00
parent 3722a2a9d5
commit f66b0d57d1
2 changed files with 2 additions and 2 deletions

View File

@ -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'])

View File

@ -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'])