diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-06-22 17:07:26 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-06-22 17:07:26 -0400 |
| commit | 7398819cc00a078a486b4d2f11846ff32db19a88 (patch) | |
| tree | 100e86627d2c1c8c008a0432cffd5e0c7e5d06fc /nova/api | |
| parent | 7cb4d3150bf0883944624d46bc458cfd25fa1c9a (diff) | |
moving image show/update into 'meta' container
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/image_metadata.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/nova/api/openstack/image_metadata.py b/nova/api/openstack/image_metadata.py index ebfe2bde9..07f0fb4fb 100644 --- a/nova/api/openstack/image_metadata.py +++ b/nova/api/openstack/image_metadata.py @@ -59,7 +59,7 @@ class Controller(object): context = req.environ['nova.context'] metadata = self._get_metadata(context, image_id) if id in metadata: - return {id: metadata[id]} + return {'meta': {id: metadata[id]}} else: return faults.Fault(exc.HTTPNotFound()) @@ -77,15 +77,22 @@ class Controller(object): def update(self, req, image_id, id, body): context = req.environ['nova.context'] - if not id in body: + + try: + meta = body['meta'] + except KeyError: + expl = _('Incorrect request body format') + raise exc.HTTPBadRequest(explanation=expl) + + if not id in meta: expl = _('Request body and URI mismatch') raise exc.HTTPBadRequest(explanation=expl) - if len(body) > 1: + if len(meta) > 1: expl = _('Request body contains too many items') raise exc.HTTPBadRequest(explanation=expl) img = self.image_service.show(context, image_id) metadata = self._get_metadata(context, image_id, img) - metadata[id] = body[id] + metadata[id] = meta[id] self._check_quota_limit(context, metadata) img['properties'] = metadata self.image_service.update(context, image_id, img, None) |
