From d774b3a2fb80f73cb2508a5273645589950c4975 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Fri, 7 Dec 2012 09:17:09 -0600 Subject: Traceback when user doesn't have permission. When a user tries to access an image that is forbidden it sends an HTTPForbidden. Inform the user with a help message that the permission is not available to them. Change-Id: I3082c789876440226b5f177216ec628436c7b3ce Signed-off-by: Chuck Short --- nova/image/glance.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/image') diff --git a/nova/image/glance.py b/nova/image/glance.py index ce6fd530f..9a93df2ab 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -275,12 +275,15 @@ class GlanceImageService(object): :raises: ImageNotFound if the image does not exist. :raises: NotAuthorized if the user is not an owner. + :raises: ImageNotAuthorized if the user is not authorized. """ try: self._client.call(context, 1, 'delete', image_id) except glanceclient.exc.NotFound: raise exception.ImageNotFound(image_id=image_id) + except glanceclient.exc.HTTPForbidden: + raise exception.ImageNotAuthorized(image_id=image_id) return True @staticmethod -- cgit