From 4d3f996e7ce5385688f6e570b8ac73327bac9f44 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 14 Mar 2016 16:53:51 +0800 Subject: Log hint when --enable present with --disable-reason --enable and --disable-reason should be mutually exclusive in "compute service set" command, but now when they are present at the same time, --disable-reason would be ignored silently. Fix these and add some hints about --disable-reason argument is ignored in this situation. Change-Id: I43254b6bc40fcae4fd0dc3457f26fad84c267072 Closes-Bug: #1556801 --- openstackclient/compute/v2/service.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py index 68037c94..2b51af3d 100644 --- a/openstackclient/compute/v2/service.py +++ b/openstackclient/compute/v2/service.py @@ -17,6 +17,7 @@ from openstackclient.common import command from openstackclient.common import utils +from openstackclient.i18n import _ # noqa class DeleteService(command.Command): @@ -117,8 +118,8 @@ class SetService(command.Command): "--disable-reason", default=None, metavar="", - help="Reason for disabling the service (in quotas)" - ) + help="Reason for disabling the service (in quotas). Note that " + "when the service is enabled, this option is ignored.") return parser def take_action(self, parsed_args): @@ -133,4 +134,8 @@ class SetService(command.Command): else: cs.disable(parsed_args.host, parsed_args.service) else: + if parsed_args.disable_reason: + msg = _("argument --disable-reason has been ignored") + self.log.info(msg) + cs.enable(parsed_args.host, parsed_args.service) -- cgit v1.2.1