From 8664a2f8aecd3d91a929e7e2b76772cae20f41e1 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 14 Mar 2016 18:07:23 +0800 Subject: Support "--long" option in ListService Add "--long" option in ListService so that compute service disabled reason can be showed. Change-Id: I1ace8f1c4e4efe0a1a8f6710425d73eb5db9e5e1 Closes-Bug: #1556815 --- openstackclient/compute/v2/service.py | 36 ++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py index 1cc91711..89f5cad9 100644 --- a/openstackclient/compute/v2/service.py +++ b/openstackclient/compute/v2/service.py @@ -49,19 +49,37 @@ class ListService(command.Lister): "--service", metavar="", help="Name of service") + parser.add_argument( + "--long", + action="store_true", + default=False, + help="List additional fields in output" + ) return parser def take_action(self, parsed_args): compute_client = self.app.client_manager.compute - columns = ( - "Id", - "Binary", - "Host", - "Zone", - "Status", - "State", - "Updated At" - ) + if parsed_args.long: + columns = ( + "Id", + "Binary", + "Host", + "Zone", + "Status", + "State", + "Updated At", + "Disabled Reason" + ) + else: + columns = ( + "Id", + "Binary", + "Host", + "Zone", + "Status", + "State", + "Updated At" + ) data = compute_client.services.list(parsed_args.host, parsed_args.service) return (columns, -- cgit v1.2.1