From f4906f07cd49e4deae79018d7f586b16266859eb Mon Sep 17 00:00:00 2001 From: Sirisha Devineni Date: Fri, 14 Sep 2012 23:04:37 +0530 Subject: Raise BadRequest while creating server with invalid personality Handle UnicodeDecodeError raises from compute api while trying to create server with invalid personality content and throw it as HTTPBadRequest Fixed bug 1050409 Change-Id: I27d47bbc9ed89abfa9827512fbfb3b16a0d87160 --- nova/api/openstack/compute/servers.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index c949ad661..d06ebc1e6 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -823,6 +823,9 @@ class Controller(wsgi.Controller): msg = "%(err_type)s: %(err_msg)s" % {'err_type': err.exc_type, 'err_msg': err.value} raise exc.HTTPBadRequest(explanation=msg) + except UnicodeDecodeError as error: + msg = "UnicodeError: %s" % unicode(error) + raise exc.HTTPBadRequest(explanation=msg) # Let the caller deal with unhandled exceptions. # If the caller wanted a reservation_id, return it -- cgit