From c1d918b2cf223d231d8a52d924c742e04a63714b Mon Sep 17 00:00:00 2001 From: gtt116 <gtt116@gmail.com> Date: Wed, 26 Feb 2014 05:02:22 +0000 Subject: [PATCH] Add service-list show `id` column In nova this patch https://review.openstack.org/#/c/39998/ can show service's id. Then user can use the id to delete service. This patch support show service's id Change-Id: I9fae88743ab7faea5e3fb64643f0bc9171e5b009 Implements: blueprint support-delete-service --- novaclient/v1_1/shell.py | 6 ++++++ novaclient/v3/shell.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index 24317642c..382a8983c 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -2850,6 +2850,12 @@ def do_service_list(cs, args): # 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") + utils.print_list(result, columns) diff --git a/novaclient/v3/shell.py b/novaclient/v3/shell.py index 02706c359..792247678 100644 --- a/novaclient/v3/shell.py +++ b/novaclient/v3/shell.py @@ -2371,6 +2371,12 @@ def do_service_list(cs, args): # so as not to add the column when the extended ext is not enabled. if 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") + utils.print_list(result, columns)