diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index 87532132..4cc59816 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -422,6 +422,7 @@ class KillContainer(command.Command): opts = {} opts['id'] = parsed_args.container opts['signal'] = parsed_args.signal + opts = _remove_null_parms(**opts) try: client.containers.kill(**opts) print(_('Request to send kill signal to container %s has ' diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index 1d10dd9f..48d87ff5 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -65,7 +65,7 @@ def _check_restart_policy(policy): def _remove_null_parms(**kwargs): new = {} for (key, value) in kwargs.items(): - if value: + if value is not None: new[key] = value return new @@ -348,6 +348,7 @@ def do_kill(cs, args): opts = {} opts['id'] = container opts['signal'] = args.signal + opts = _remove_null_parms(**opts) try: cs.containers.kill(**opts) print( @@ -461,10 +462,9 @@ def do_rename(cs, args): def do_update(cs, args): """Updates one or more container attributes""" opts = {} - if args.memory is not None: - opts['memory'] = args.memory - if args.cpu is not None: - opts['cpu'] = args.cpu + opts['memory'] = args.memory + opts['cpu'] = args.cpu + opts = _remove_null_parms(**opts) if not opts: raise exc.CommandError("You must update at least one property") container = cs.containers.update(args.container, **opts)