yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #81309
[Bug 1837199] Re: nova-manage Tracebeck on missing arg
Reviewed: https://review.opendev.org/694806
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=51b0d4ca58f70fdd887dd053bfae1b2c918c33ba
Submitter: Zuul
Branch: master
commit 51b0d4ca58f70fdd887dd053bfae1b2c918c33ba
Author: Matt Riedemann <mriedem.os@xxxxxxxxx>
Date: Mon Nov 18 11:36:20 2019 -0500
Print help if nova-manage subcommand is not specified
If a nova-manage command is executed without the -h option
or a subcommand the user gets an ugly traceback. This is
easily recreated:
$ tox -e venv -- nova-manage db
Make the action argument required, so we get a helpful error message
instead.
$ nova-manage db
usage: nova-manage db [-h]
{archive_deleted_rows,ironic_flavor_migration,
null_instance_uuid_scan,online_data_migrations,
purge,sync,version}
...
nova-manage db: error: the following arguments are required: action
Note that unit tests appear to be impossible for this, since doing so
attempts to initialize an oslo.config 'CONF' singleton and this is
something we've already done in 'nova.test' and can't do again.
Change-Id: I24d03eed3aa3b882c49916938f4c25d76fd4e831
Closes-Bug: #1837199
Co-Authored-By: Stephen Finucane <stephenfin@xxxxxxxxxx>
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1837199
Title:
nova-manage Tracebeck on missing arg
Status in OpenStack Compute (nova):
Fix Released
Status in OpenStack Compute (nova) queens series:
Confirmed
Status in OpenStack Compute (nova) stein series:
Confirmed
Status in OpenStack Compute (nova) train series:
Confirmed
Bug description:
# nova-manage cell_v2
An error has occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/oslo_config/cfg.py", line 3179, in __getattr__
return getattr(self._conf._namespace, name)
AttributeError: '_Namespace' object has no attribute 'action_fn'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/stack/nova/nova/cmd/manage.py", line 2205, in main
fn, fn_args, fn_kwargs = cmd_common.get_action_fn()
File "/opt/stack/nova/nova/cmd/common.py", line 169, in get_action_fn
fn = CONF.category.action_fn
File "/usr/local/lib/python3.7/site-packages/oslo_config/cfg.py", line 3181, in __getattr__
raise NoSuchOptError(name)
oslo_config.cfg.NoSuchOptError: no such option action_fn in group [DEFAULT]
# nova-manage cell_v2 help
usage: nova-manage cell_v2 [-h]
{create_cell,delete_cell,delete_host,discover_hosts,list_cells,list_hosts,map_cell0,map_cell_and_hosts,map_instances,simple_cell_setup,update_cell,verify_instance}
...
nova-manage cell_v2: error: argument action: invalid choice: 'help' (choose from 'create_cell', 'delete_cell', 'delete_host', 'discover_hosts', 'list_cells', 'list_hosts', 'map_cell0', 'map_cell_and_hosts', 'map_instances', 'simple_cell_setup', 'update_cell', 'verify_instance')
# nova-manage cell_v2 -h
usage: nova-manage cell_v2 [-h]
{create_cell,delete_cell,delete_host,discover_hosts,list_cells,list_hosts,map_cell0,map_cell_and_hosts,map_instances,simple_cell_setup,update_cell,verify_instance}
...
positional arguments:
{create_cell,delete_cell,delete_host,discover_hosts,list_cells,list_hosts,map_cell0,map_cell_and_hosts,map_instances,simple_cell_setup,update_cell,verify_instance}
optional arguments:
-h, --help show this help message and exit
python version:
/usr/bin/python3 --version
Python 3.7.3
nova version:
$ git log -1
commit 78f9961d293e3b3e0ac62345b78abb1c9e2bd128 (HEAD -> master, origin/master, origin/HEAD)
oslo.config 6.11.0
Instead of printing Traceback, nova-manage should give a hint for the
user choices.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1837199/+subscriptions
References