diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-01-15 07:34:36 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-01-15 07:34:36 +0000 |
| commit | 8dd8cdcdfebd0ad26bd3ddba8b6e75d1793d290b (patch) | |
| tree | fb97504a83c06ead53b0d50b402afa2c87c95333 /openstackclient/identity | |
| parent | 454c19e58d2817e08d459605830811ef2ee62eb6 (diff) | |
| parent | 369ae3f9f06c90e8d57b71befa6bc22a843c2f7d (diff) | |
| download | python-openstackclient-8dd8cdcdfebd0ad26bd3ddba8b6e75d1793d290b.tar.gz | |
Merge "Check if service.name available before access"
Diffstat (limited to 'openstackclient/identity')
| -rw-r--r-- | openstackclient/identity/v3/endpoint.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/openstackclient/identity/v3/endpoint.py b/openstackclient/identity/v3/endpoint.py index 5b8104e5..52db5ace 100644 --- a/openstackclient/identity/v3/endpoint.py +++ b/openstackclient/identity/v3/endpoint.py @@ -27,6 +27,13 @@ from openstackclient.common import utils from openstackclient.identity import common +def get_service_name(service): + if hasattr(service, 'name'): + return service.name + else: + return '' + + class CreateEndpoint(show.ShowOne): """Create new endpoint""" @@ -87,7 +94,7 @@ class CreateEndpoint(show.ShowOne): info = {} endpoint._info.pop('links') info.update(endpoint._info) - info['service_name'] = service.name + info['service_name'] = get_service_name(service) info['service_type'] = service.type return zip(*sorted(six.iteritems(info))) @@ -157,7 +164,7 @@ class ListEndpoint(lister.Lister): for ep in data: service = common.find_service(identity_client, ep.service_id) - ep.service_name = service.name + ep.service_name = get_service_name(service) ep.service_type = service.type return (columns, (utils.get_item_properties( @@ -274,6 +281,6 @@ class ShowEndpoint(show.ShowOne): info = {} endpoint._info.pop('links') info.update(endpoint._info) - info['service_name'] = service.name + info['service_name'] = get_service_name(service) info['service_type'] = service.type return zip(*sorted(six.iteritems(info))) |
