Do not send 'auto_heal' if not specified

If users don't specify the --auto-heal option, don't include
the 'auto_heal' parameter in the request. This is because legacy
API version won't support this parameter.

Change-Id: I2a4ec5f0d0594e447853a36752c85b9918558d3a
Closes-Bug: #1782059
This commit is contained in:
Hongbin Lu 2018-07-17 04:02:53 +00:00
parent a2cdcb9097
commit 8e461cfb9e
3 changed files with 8 additions and 5 deletions

View File

@ -230,7 +230,8 @@ class CreateContainer(command.ShowOne):
opts['hostname'] = parsed_args.hostname
opts['disk'] = parsed_args.disk
opts['availability_zone'] = parsed_args.availability_zone
opts['auto_heal'] = parsed_args.auto_heal
if parsed_args.auto_heal:
opts['auto_heal'] = parsed_args.auto_heal
if parsed_args.healthcheck:
opts['healthcheck'] = \
zun_utils.parse_health(parsed_args.healthcheck)
@ -872,7 +873,8 @@ class RunContainer(command.ShowOne):
opts['hostname'] = parsed_args.hostname
opts['disk'] = parsed_args.disk
opts['availability_zone'] = parsed_args.availability_zone
opts['auto_heal'] = parsed_args.auto_heal
if parsed_args.auto_heal:
opts['auto_heal'] = parsed_args.auto_heal
if parsed_args.healthcheck:
opts['healthcheck'] = \
zun_utils.parse_health(parsed_args.healthcheck)

View File

@ -21,7 +21,6 @@ from zunclient.v1 import containers_shell
def _get_container_args(**kwargs):
default_args = {
'auto_heal': False,
'auto_remove': False,
'environment': {},
'hints': {},

View File

@ -185,11 +185,12 @@ def do_create(cs, args):
opts['hostname'] = args.hostname
opts['disk'] = args.disk
opts['availability_zone'] = args.availability_zone
opts['auto_heal'] = args.auto_heal
opts['command'] = args.command
if args.healthcheck:
opts['healthcheck'] = zun_utils.parse_health(args.healthcheck)
if args.auto_heal:
opts['auto_heal'] = args.auto_heal
if args.security_group:
opts['security_groups'] = args.security_group
if args.restart:
@ -693,11 +694,12 @@ def do_run(cs, args):
opts['hostname'] = args.hostname
opts['disk'] = args.disk
opts['availability_zone'] = args.availability_zone
opts['auto_heal'] = args.auto_heal
opts['command'] = args.command
if args.healthcheck:
opts['healthcheck'] = zun_utils.parse_health(args.healthcheck)
if args.auto_heal:
opts['auto_heal'] = args.auto_heal
if args.security_group:
opts['security_groups'] = args.security_group
if args.restart: