Skip to content

Commit a8f60a8

Browse files
committed
fix some small issues in catalog show
I think there are three issues we should fix: 1. wrong indentation of 'continue' 2. currently, name is optional for service, but according to the currrent logic, if a service doesn't have name attribute we will select it anyway 3. we always loop all catalogs Change-Id: I9fce66677affa396b6a12afea76e87cab9215a58
1 parent d2943d2 commit a8f60a8

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎openstackclient/identity/v2_0/catalog.py‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,12 @@ def take_action(self, parsed_args):
8383

8484
data = None
8585
for service in sc.get_data():
86-
if (
87-
'name' in service and
88-
service['name'] != parsed_args.service and
89-
'type' in service and
90-
service['type'] != parsed_args.service
91-
):
92-
continue
93-
94-
data = service
95-
data['endpoints'] = _format_endpoints(data['endpoints'])
96-
if 'endpoints_links' in data:
97-
data.pop('endpoints_links')
86+
if (service.get('name') == parsed_args.service or
87+
service.get('type') == parsed_args.service):
88+
data = service
89+
data['endpoints'] = _format_endpoints(data['endpoints'])
90+
if 'endpoints_links' in data:
91+
data.pop('endpoints_links')
92+
break
9893

9994
return zip(*sorted(six.iteritems(data)))

0 commit comments

Comments
 (0)