summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony NIU <niuwl586@gmail.com>2013-01-17 13:52:24 +0800
committerTony NIU <niuwl586@gmail.com>2013-01-23 09:29:07 +0800
commita99ddf204a32cf9390bc00eb5e6ca4ede956f034 (patch)
tree38712eb48f22d6d847e2b870fa3624d3ff4f14e9
parent65d75430af77367622e660f57361b972a0f8dac1 (diff)
downloadnova-a99ddf204a32cf9390bc00eb5e6ca4ede956f034.tar.gz
nova-a99ddf204a32cf9390bc00eb5e6ca4ede956f034.tar.xz
nova-a99ddf204a32cf9390bc00eb5e6ca4ede956f034.zip
Fixed nova-manage argument parsing error
In the dictionary CATEGORIES of file nova-manage, both 'flavor' and 'instance_type' refer to InstanceTypeCommands, so the category would be handled twice by add_command_parsers(). It would mess the arguments if a command category is handled more than once by function add_command_parsers(). Added a check to avoid the mess. Change-Id: I7a314a9b389b3dea848a7111cedfc762bbb6b30e Fixes: bug #1098733
-rwxr-xr-xbin/nova-manage9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 4f3d889ea..90d191eca 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -1128,8 +1128,13 @@ def add_command_parsers(subparsers):
action_kwargs = []
for args, kwargs in getattr(action_fn, 'args', []):
- action_kwargs.append(kwargs['dest'])
- kwargs['dest'] = 'action_kwarg_' + kwargs['dest']
+ if kwargs['dest'].startswith('action_kwarg_'):
+ action_kwargs.append(
+ kwargs['dest'][len('action_kwarg_'):])
+ else:
+ action_kwargs.append(kwargs['dest'])
+ kwargs['dest'] = 'action_kwarg_' + kwargs['dest']
+
parser.add_argument(*args, **kwargs)
parser.set_defaults(action_fn=action_fn)