c08d6e0391
If you use the former, you get a pretty error message when there's a failure. If you use the latter, you get an ugly traceback when used with the '--debug' flag. Without this change: $ openstack flavor create ... --property '' foo ... Traceback (most recent call last): File "/tmp/venv/lib/python3.11/site-packages/cliff/app.py", line 402, in run_subcommand parsed_args = cmd_parser.parse_args(sub_argv) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/argparse.py", line 1862, in parse_args args, argv = self.parse_known_args(args, namespace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/argparse.py", line 1895, in parse_known_args namespace, args = self._parse_known_args(args, namespace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/argparse.py", line 2107, in _parse_known_args start_index = consume_optional(start_index) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/argparse.py", line 2047, in consume_optional take_action(action, args, option_string) File "/usr/lib64/python3.11/argparse.py", line 1971, in take_action action(self, namespace, argument_values, option_string) File "/tmp/venv/lib/python3.11/site-packages/osc_lib/cli/parseractions.py", line 45, in __call__ raise argparse.ArgumentTypeError(msg % str(values)) argparse.ArgumentTypeError: Expected 'key=value' type, but got: clean_up CreateFlavor: Expected 'key=value' type, but got: With this change: $ openstack flavor create ... --property '' foo ... usage: openstack flavor create [-h] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width <integer>] [--fit-width] [--print-empty] [--id <id>] [--ram <size-mb>] [--disk <size-gb>] [--ephemeral <size-gb>] [--swap <size-mb>] [--vcpus <vcpus>] [--rxtx-factor <factor>] [--public | --private] [--property <key=value>] [--project <project>] [--description <description>] [--project-domain <project-domain>] <flavor-name> openstack flavor create: error: argument --property: Expected 'key=value' type, but got: clean_up CreateFlavor: Change-Id: I9e78b35ad9d016d7a33655141ec579397c5344c0 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> |
||
---|---|---|
.. | ||
v1 | ||
v2 | ||
v3 | ||
__init__.py | ||
test_find_resource.py |