qvm-pool simplify options parsing
This commit is contained in:
parent
27305dd85d
commit
c8363cfc95
@ -136,14 +136,8 @@ class _Options(argparse.Action):
|
|||||||
help='comma-separated list of driver options')
|
help='comma-separated list of driver options')
|
||||||
|
|
||||||
def __call__(self, parser, namespace, options, option_string=None):
|
def __call__(self, parser, namespace, options, option_string=None):
|
||||||
result = {}
|
setattr(namespace, 'options',
|
||||||
for option in options.split(','):
|
dict([option.split('=', 1) for option in options.split(',')]))
|
||||||
if option.count('=') != 1:
|
|
||||||
parser.error('option %s should have form option=value' %
|
|
||||||
option)
|
|
||||||
name, value = option.split('=')
|
|
||||||
result[name] = value
|
|
||||||
setattr(namespace, 'options', result)
|
|
||||||
|
|
||||||
|
|
||||||
def get_parser():
|
def get_parser():
|
||||||
|
Loading…
Reference in New Issue
Block a user