summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-11-16 14:48:45 -0800
committerJoe Gordon <jogo@cloudscaling.com>2012-12-06 13:28:15 +0200
commit59f6d3b63b3a32875a1835cb3ff9bbddf2b192ee (patch)
tree31e4647598d0513a54a54def995510ff9c636136
parenteb39f01402117871f125023be0985ff90b277fb1 (diff)
downloadnova-59f6d3b63b3a32875a1835cb3ff9bbddf2b192ee.tar.gz
nova-59f6d3b63b3a32875a1835cb3ff9bbddf2b192ee.tar.xz
nova-59f6d3b63b3a32875a1835cb3ff9bbddf2b192ee.zip
Improve nova-manage usability
Prevent nova-manage from stack tracing when the wrong number of arguments are passed in. Fixes bug 1083315 Change-Id: I7b9a237a82b4255d88c01c6a56ad0ccd4a6ee984
-rwxr-xr-xbin/nova-manage14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 6e90e2e00..aa92d5ef0 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -79,6 +79,7 @@ from nova import db
from nova.db import migration
from nova import exception
from nova.openstack.common import cfg
+from nova.openstack.common import cliutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
@@ -1160,15 +1161,18 @@ def main():
fn_args = [arg.decode('utf-8') for arg in fn_args]
# call the action with the remaining arguments
+ # check arguments
+ try:
+ cliutils.validate_args(fn, *fn_args, **fn_kwargs)
+ except cliutils.MissingArgs as e:
+ print fn.__doc__
+ parser.print_help()
+ print e
+ sys.exit(1)
try:
fn(*fn_args, **fn_kwargs)
rpc.cleanup()
sys.exit(0)
- except TypeError:
- print _("Possible wrong number of arguments supplied")
- print fn.__doc__
- parser.print_help()
- raise
except Exception:
print _("Command failed, please check log for more info")
raise