summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorRui Chen <chenrui.momo@gmail.com>2016-03-14 16:53:51 +0800
committerRui Chen <chenrui.momo@gmail.com>2016-04-05 21:22:27 +0800
commit4d3f996e7ce5385688f6e570b8ac73327bac9f44 (patch)
tree085b3b9268eccdf919d5cc95e306569194cfcc27 /openstackclient/compute
parent97492c168f395eb80009162eb2e242dde23e0ba5 (diff)
downloadpython-openstackclient-4d3f996e7ce5385688f6e570b8ac73327bac9f44.tar.gz
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
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/service.py9
1 files changed, 7 insertions, 2 deletions
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="<reason>",
- 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)