Revision b696ed2c
b/kamaki/cli/argument.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from kamaki.cli.config import Config |
35 |
from kamaki.cli.errors import CLISyntaxError |
|
35 |
from kamaki.cli.errors import CLISyntaxError, raiseCLIError
|
|
36 | 36 |
from kamaki.cli.utils import split_input |
37 | 37 |
|
38 | 38 |
from argparse import ArgumentParser, ArgumentError |
... | ... | |
180 | 180 |
for option in options: |
181 | 181 |
keypath, sep, val = option.partition('=') |
182 | 182 |
if not sep: |
183 |
raise CLISyntaxError('Argument Syntax Error ', |
|
184 |
details='%s is missing a "=" (usage: -o section.key=val)'\ |
|
185 |
% option) |
|
183 |
raiseCLIError(CLISyntaxError('Argument Syntax Error '), |
|
184 |
details=['%s is missing a "="', |
|
185 |
' (usage: -o section.key=val)' % option] |
|
186 |
) |
|
186 | 187 |
section, sep, key = keypath.partition('.') |
187 | 188 |
if not sep: |
188 | 189 |
key = section |
... | ... | |
227 | 228 |
try: |
228 | 229 |
self._value = int(newvalue) |
229 | 230 |
except ValueError: |
230 |
raise CLISyntaxError('IntArgument Error',
|
|
231 |
raiseCLIError(CLISyntaxError('IntArgument Error'),
|
|
231 | 232 |
details='Value %s not an int' % newvalue) |
232 | 233 |
|
233 | 234 |
|
... | ... | |
274 | 275 |
for pair in keyvalue_pairs: |
275 | 276 |
key, sep, val = pair.partition('=') |
276 | 277 |
if not sep: |
277 |
raise CLISyntaxError('Argument syntax error ',
|
|
278 |
raiseCLIError(CLISyntaxError('Argument syntax error '),
|
|
278 | 279 |
details='%s is missing a "=" (usage: key1=val1 )\n' % pair) |
279 | 280 |
self._value[key.strip()] = val.strip() |
280 | 281 |
|
Also available in: Unified diff