summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dan.prince@rackspace.com>2011-03-22 10:01:18 -0400
committerDan Prince <dan.prince@rackspace.com>2011-03-22 10:01:18 -0400
commit7aa027b2005ff24f7308e1ec23eddb44bf352628 (patch)
treed142aa9766e80a9ca96116aba43b18200580a55e /nova/api
parent3ae9a489667ed6f4b03a19d5e14bec8e1d4eb20d (diff)
Add unit test and code updates to ensure that a PUT requests to
create/update server metadata only contain a single key.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/server_metadata.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/api/openstack/server_metadata.py b/nova/api/openstack/server_metadata.py
index 1408f59a6..45bbac99d 100644
--- a/nova/api/openstack/server_metadata.py
+++ b/nova/api/openstack/server_metadata.py
@@ -55,6 +55,9 @@ class Controller(wsgi.Controller):
if not id in body:
expl = _('Request body and URI mismatch')
raise exc.HTTPBadRequest(explanation=expl)
+ if len(body) > 1:
+ expl = _('Request body contains too many items')
+ raise exc.HTTPBadRequest(explanation=expl)
self.compute_api.update_or_create_instance_metadata(context,
server_id,
body)