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
This commit is contained in:
@@ -1128,8 +1128,13 @@ def add_command_parsers(subparsers):
|
||||
|
||||
action_kwargs = []
|
||||
for args, kwargs in getattr(action_fn, 'args', []):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user