(self, request)
return json.dumps({'metadata': content['metadata']})
Set the metadata for the specified server - this replaces whatever
        metadata was there.  The resulting metadata is not a union of the
        previous metadata and the new metadata - it is *just* the new
        metadata.

        The body must look like:

        ``{"metadata": {...}}``

        although

        ``{"metadata": {...}, "other": "garbage", "keys": "included"}``

        is ok too.

        All the response messages and codes have been verified as of
        2015-04-23 against Rackspace Nova.
Set the metadata for the specified server - this replaces whatever
        metadata was there.  The resulting metadata is not a union of the
        previous metadata and the new metadata - it is *just* the new
        metadata.
Set the metadata for the specified server - this replaces whatever metadata was there . The resulting metadata is not a union of the previous metadata and the new metadata - it is * just * the new metadata .
def set_metadata(self, request):
        """
        Set the metadata for the specified server - this replaces whatever
        metadata was there.  The resulting metadata is not a union of the
        previous metadata and the new metadata - it is *just* the new
        metadata.

        The body must look like:

        ``{"metadata": {...}}``

        although

        ``{"metadata": {...}, "other": "garbage", "keys": "included"}``

        is ok too.

        All the response messages and codes have been verified as of
        2015-04-23 against Rackspace Nova.
        """
        try:
            content = json_from_request(request)
        except ValueError:
            return json.dumps(bad_request("Malformed request body", request))

        # more than one key is ok, non-"meta" keys are just ignored
        if 'metadata' not in content:
            return json.dumps(bad_request("Malformed request body", request))

        # When setting metadata, None is special for some reason
        if content['metadata'] is None:
            return json.dumps(bad_request(
                "Malformed request body. metadata must be object", request))

        try:
            Server.validate_metadata(content['metadata'])
        except BadRequestError as e:
            return json.dumps(bad_request(e.nova_message, request))
        except LimitError as e:
            return json.dumps(forbidden(e.nova_message, request))

        self._server.set_metadata(content['metadata'])
        return json.dumps({'metadata': content['metadata']})
def set_metadata ( self , request ) : try : content = json_from_request ( request ) except ValueError : return json . dumps ( bad_request ( "Malformed request body" , request ) ) # more than one key is ok, non-"meta" keys are just ignored if 'metadata' not in content : return json . dumps ( bad_request ( "Malformed request body" , request ) ) # When setting metadata, None is special for some reason if content [ 'metadata' ] is None : return json . dumps ( bad_request ( "Malformed request body. metadata must be object" , request ) ) try : Server . validate_metadata ( content [ 'metadata' ] ) except BadRequestError as e : return json . dumps ( bad_request ( e . nova_message , request ) ) except LimitError as e : return json . dumps ( forbidden ( e . nova_message , request ) ) self . _server . set_metadata ( content [ 'metadata' ] ) return json . dumps ( { 'metadata' : content [ 'metadata' ] } )