Expect id and disabled_reason in GET /os-services response

Since we no longer have v2 extensions, the GET /os-services
response is going to have an id and disabled_reason field,
so we don't need to have conditional checks around those.

Change-Id: I5d11ffb48febb53f70bf1193b2cba5ec839a3f0d
This commit is contained in:
Matt Riedemann 2017-07-19 22:34:58 -04:00
parent 02145d765c
commit ed058c46a1
1 changed files with 2 additions and 11 deletions

View File

@ -3469,17 +3469,8 @@ def do_reset_network(cs, args):
def do_service_list(cs, args):
"""Show a list of all running services. Filter by host & binary."""
result = cs.services.list(host=args.host, binary=args.binary)
columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"]
# NOTE(sulo): we check if the response has disabled_reason
# so as not to add the column when the extended ext is not enabled.
if result and hasattr(result[0], 'disabled_reason'):
columns.append("Disabled Reason")
# NOTE(gtt): After https://review.openstack.org/#/c/39998/ nova will
# show id in response.
if result and hasattr(result[0], 'id'):
columns.insert(0, "Id")
columns = ["Id", "Binary", "Host", "Zone", "Status",
"State", "Updated_at", "Disabled Reason"]
utils.print_list(result, columns)