From fd3cad62732afddec6708f330b1ce967349125b0 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 12 Jan 2012 14:27:50 -0800 Subject: Make authz failures use proper response code * Improvement for blueprint interim-nova-authz-service * Added tests to verify raise Change-Id: Ibf6bc3327abab1f3ae752aa350f1628c67b03260 --- nova/api/openstack/wsgi.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 2bd6fa817..f8790d9f0 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -840,6 +840,9 @@ class Resource(wsgi.Application): response = None try: action_result = self.dispatch(meth, request, action_args) + except exception.NotAuthorized as ex: + msg = unicode(ex) + response = Fault(webob.exc.HTTPUnauthorized(explanation=msg)) except TypeError as ex: LOG.exception(ex) response = Fault(webob.exc.HTTPBadRequest()) -- cgit