Fix for adopt glance.store library in Glance

The store module is removed from glance project and new glance_store
module is created, but the glance project code was not updated
properly for the required changes.

_get_from_store and _get_size methods raises store.NotFound exception
from glance_store but not caught in the glance api.

Updated exception.NotFound to store.NotFound which returns 404 NotFound
response to the user.

Closes-Bug: #1380552
Change-Id: I068cb90f5db62443115157a027fbdefec9bd4a00
This commit is contained in:
ankitagrawal 2014-10-13 07:56:53 -07:00
parent 2365a3fb5f
commit 675a39a74f
1 changed files with 2 additions and 2 deletions

View File

@ -459,7 +459,7 @@ class Controller(controller.BaseController):
image_data, image_size = src_store.get(loc, context=context)
except exception.NotFound as e:
except store.NotFound as e:
raise HTTPNotFound(explanation=e.msg)
image_size = int(image_size) if image_size else None
return image_data, image_size
@ -721,7 +721,7 @@ class Controller(controller.BaseController):
try:
return (image_meta.get('size', 0) or
store.get_size_from_backend(location, context=context))
except (exception.NotFound, store.BadStoreUri) as e:
except (store.NotFound, store.BadStoreUri) as e:
LOG.debug(e)
raise HTTPBadRequest(explanation=e.msg, content_type="text/plain")