From ae808ad735c39c0bff3e051dbd37ea2a60072649 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Tue, 17 Jan 2012 20:28:13 +0000 Subject: Stop allowing blank image names on snapshot/backup Fixes bug 917327 Change-Id: I0b77b088c9fe99354bcec3706fbdc05f3c39ae90 --- nova/api/openstack/compute/servers.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 274589696..560e67fed 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -1089,17 +1089,12 @@ class Controller(wsgi.Controller): context = req.environ['nova.context'] entity = body.get("createImage", {}) - try: - image_name = entity["name"] + image_name = entity.get("name") - except KeyError: + if not image_name: msg = _("createImage entity requires name attribute") raise exc.HTTPBadRequest(explanation=msg) - except TypeError: - msg = _("Malformed createImage entity") - raise exc.HTTPBadRequest(explanation=msg) - props = {} metadata = entity.get('metadata', {}) common.check_img_metadata_quota_limit(context, metadata) -- cgit