Fix invalid error message in neutron-cli
Error message displayed is not correct when we provide invalid syntax for optional arguments in neutron CLI Closes-bug: 1438518 Change-Id: If5f875f657c977868c934a21d663e6d1a0a5158e
This commit is contained in:
parent
aa1215a5ad
commit
7bc65cb9a5
@ -288,6 +288,10 @@ def parse_args_to_dict(values_specs):
|
||||
_("Invalid values_specs %s") % ' '.join(values_specs))
|
||||
_value_number += 1
|
||||
|
||||
if _item.startswith('---'):
|
||||
raise exceptions.CommandError(
|
||||
_("Invalid values_specs %s") % ' '.join(values_specs))
|
||||
|
||||
_values_specs.append(_item)
|
||||
|
||||
# Deal with last one argument
|
||||
|
@ -78,6 +78,11 @@ class CLITestArgs(testtools.TestCase):
|
||||
self.assertEqual('value1',
|
||||
neutronV20.parse_args_to_dict(_specs)['arg1'])
|
||||
|
||||
def test_arg_invalid_syntax(self):
|
||||
_specs = ['--tag=t', '---arg1', 'value1']
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
neutronV20.parse_args_to_dict, _specs)
|
||||
|
||||
def test_dict_arg(self):
|
||||
_specs = ['--tag=t', '--arg1', 'type=dict', 'key1=value1,key2=value2']
|
||||
arg1 = neutronV20.parse_args_to_dict(_specs)['arg1']
|
||||
|
Loading…
x
Reference in New Issue
Block a user