@extensions.expected_errors((400, 404, 501))
    @validation.schema(hosts.update)
    def update(self, req, id, body):
        """Return booleanized version of body dict.

        :param Request req: The request object (containing 'nova-context'
                            env var).
        :param str id: The host name.
        :param dict body: example format {'host': {'status': 'enable',
                          'maintenance_mode': 'enable'}}
        :return: Same dict as body but 'enable' strings for 'status' and
                 'maintenance_mode' are converted into True, else False.
        :rtype: dict
        """
        def read_enabled(orig_val):
            # Convert enable/disable str to a bool.
            val = orig_val.strip().lower()
            return val == "enable"

        context = req.environ['nova.context']
        authorize(context)
        # See what the user wants to 'update'
        status = body.get('status')
        maint_mode = body.get('maintenance_mode')
        if status is not None:
            status = read_enabled(status)
        if maint_mode is not None:
            maint_mode = read_enabled(maint_mode)
        # Make the calls and merge the results
        result = {'host': id}
        if status is not None:
            result['status'] = self._set_enabled_status(context, id, status)
        if maint_mode is not None:
            result['maintenance_mode'] = self._set_host_maintenance(context,
                                                                    id,
                                                                    maint_mode)
        return result
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/hosts.py/HostController.update/original