diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index a44f3564..476f984a 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -914,7 +914,17 @@ class UpdateContainer(command.ShowOne): '--name', metavar='', help='The new name of container to update') - + auto_heal_value = parser.add_mutually_exclusive_group() + auto_heal_value.add_argument( + '--auto-heal', + required=False, + action='store_true', + help='Automatic recovery the status of contaier') + auto_heal_value.add_argument( + '--no-auto-heal', + required=False, + action='store_true', + help='Needless recovery the status of contaier') return parser def take_action(self, parsed_args): @@ -924,6 +934,10 @@ class UpdateContainer(command.ShowOne): opts['memory'] = parsed_args.memory opts['cpu'] = parsed_args.cpu opts['name'] = parsed_args.name + if 'auto_heal' in parsed_args and parsed_args.auto_heal: + opts['auto_heal'] = True + if 'no_auto_heal' in parsed_args and parsed_args.no_auto_heal: + opts['auto_heal'] = False opts = zun_utils.remove_null_parms(**opts) if not opts: raise exc.CommandError("You must update at least one property") diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index 0849c380..2f890a40 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -698,12 +698,26 @@ def do_run(cs, args): @utils.arg('--name', metavar='', help='The new name for the container') +@utils.exclusive_arg( + 'auto_heal_value', + '--auto-heal', + required=False, action='store_true', + help='Automatic recovery the status of contaier') +@utils.exclusive_arg( + 'auto_heal_value', + '--no-auto-heal', + required=False, action='store_true', + help='Needless recovery the status of contaier') def do_update(cs, args): """Update one or more attributes of the container.""" opts = {} opts['memory'] = args.memory opts['cpu'] = args.cpu opts['name'] = args.name + if 'auto_heal' in args and args.auto_heal: + opts['auto_heal'] = True + if 'no_auto_heal' in args and args.no_auto_heal: + opts['auto_heal'] = False opts = zun_utils.remove_null_parms(**opts) if not opts: raise exc.CommandError("You must update at least one property")