diff options
author | Nicolas Simonds <nic@metacloud.com> | 2016-10-12 16:01:41 -0700 |
---|---|---|
committer | Matt Riedemann <mriedem@us.ibm.com> | 2016-11-30 17:20:12 +0000 |
commit | fae461072b477d309fff9567518142acb8fa9132 (patch) | |
tree | a3d81eeb6c347b32458571f706cfd1c6e132483a | |
parent | 85a6e7e56a38742ed45f4405d448dc9cd64d1948 (diff) | |
download | python-novaclient-fae461072b477d309fff9567518142acb8fa9132.tar.gz |
Make "policy" a mandatory argument for server-group-create
Commit 6f8667990cdb3cd662d51be2403cca5859559f04 removed the deprecated
"--policy" switch, which caused the check for the missing parameter
to quietly stop working correctly.
Make "policy" a mandatory positional parameter and let argparse
figure it out; it has a much better/more helpful error message
anyways.
Closes-Bug: 1632866
Change-Id: I3234c08b1bc8ba263537bb6232280c471457f069
(cherry picked from commit 74222a6ddc1b24f46018f18afe73c7d270462822)
-rw-r--r-- | novaclient/v2/shell.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index a823cd4a..d94155f8 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -5221,27 +5221,13 @@ def do_secgroup_delete_default_rule(cs, args): @utils.arg('name', metavar='<name>', help=_('Server group name.')) -# NOTE(wingwj): The '--policy' way is still reserved here for preserving -# the backwards compatibility of CLI, even if a user won't get this usage -# in '--help' description. It will be deprecated after a suitable deprecation -# period(probably 2 coordinated releases or so). -# -# Moreover, we imagine that a given user will use only positional parameters or -# only the "--policy" option. So we don't need to properly handle -# the possibility that they might mix them here. That usage is unsupported. -# The related discussion can be found in -# https://review.openstack.org/#/c/96382/2/. @utils.arg( 'policy', metavar='<policy>', - default=argparse.SUPPRESS, - nargs='*', + nargs='+', help=_('Policies for the server groups.')) def do_server_group_create(cs, args): """Create a new server group with the specified details.""" - if not args.policy: - raise exceptions.CommandError(_("at least one policy must be " - "specified")) kwargs = {'name': args.name, 'policies': args.policy} server_group = cs.server_groups.create(**kwargs) |