Merge "Support 'True' and 'False' input for system commands"

This commit is contained in:
Zuul 2019-01-24 14:58:27 +00:00 committed by Gerrit Code Review
commit 23429c4af1
3 changed files with 9 additions and 5 deletions

View File

@ -60,7 +60,7 @@ def do_show(cc, args):
help='The name of the system')
@utils.arg('-s', '--sdn_enabled',
metavar='<sdn_enabled>',
choices=['true', 'false'],
choices=['true', 'false', 'True', 'False'],
help='The SDN enabled or disabled flag')
@utils.arg('-t', '--timezone',
metavar='<timezone>',
@ -79,7 +79,7 @@ def do_show(cc, args):
help='The location of the system')
@utils.arg('-p', '--https_enabled',
metavar='<https_enabled>',
choices=['true', 'false'],
choices=['true', 'false', 'True', 'False'],
help='The HTTPS enabled or disabled flag')
@utils.arg('-v', '--vswitch_type',
metavar='<vswitch_type>',

View File

@ -47,7 +47,7 @@ def do_network_list(cc, args):
help="Type of network [REQUIRED]")
@utils.arg('dynamic',
metavar='<dynamic>',
choices=['true', 'false'],
choices=['true', 'false', 'True', 'False'],
help="dynamic [REQUIRED]")
@utils.arg('pool_uuid',
metavar='<pool_uuid>',
@ -57,6 +57,10 @@ def do_network_add(cc, args):
field_list = ['name', 'type', 'dynamic', 'pool_uuid']
# make sure dynamic is lower
if args.dynamic is not None:
args.dynamic = args.dynamic.lower()
# Prune input fields down to required/expected values
data = dict((k, v) for (k, v) in vars(args).items()
if k in field_list and not (v is None))

View File

@ -422,11 +422,11 @@ class SystemController(rest.RestController):
timezone))
if p['path'] == '/sdn_enabled':
sdn_enabled = p['value']
sdn_enabled = p['value'].lower()
patch.remove(p)
if p['path'] == '/https_enabled':
https_enabled = p['value']
https_enabled = p['value'].lower()
patch.remove(p)
if p['path'] == '/distributed_cloud_role':