diff options
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/host.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/openstackclient/compute/v2/host.py b/openstackclient/compute/v2/host.py index 764b22af..78567589 100644 --- a/openstackclient/compute/v2/host.py +++ b/openstackclient/compute/v2/host.py @@ -54,7 +54,7 @@ class SetHost(command.Command): parser.add_argument( "host", metavar="<host>", - help=_("The host to modify (name or ID)") + help=_("Host to modify (name only)") ) status = parser.add_mutually_exclusive_group() status.add_argument( @@ -84,22 +84,24 @@ class SetHost(command.Command): kwargs = {} if parsed_args.enable: - kwargs['status'] = True + kwargs['status'] = 'enable' if parsed_args.disable: - kwargs['status'] = False + kwargs['status'] = 'disable' if parsed_args.enable_maintenance: - kwargs['maintenance_mode'] = True + kwargs['maintenance_mode'] = 'enable' if parsed_args.disable_maintenance: - kwargs['maintenance_mode'] = False + kwargs['maintenance_mode'] = 'disable' compute_client = self.app.client_manager.compute - foundhost = utils.find_resource( - compute_client.hosts, - parsed_args.host - ) + + # More than one hosts will be returned by using find_resource() + # so that the return value cannot be used in host update() method. + # find_resource() is just used for checking existence of host and + # keeping the exception message consistent with other commands. + utils.find_resource(compute_client.hosts, parsed_args.host) compute_client.hosts.update( - foundhost.id, + parsed_args.host, kwargs ) |
