diff options
author | Stuart McLaren <stuart.mclaren@hp.com> | 2014-10-09 12:23:21 +0000 |
---|---|---|
committer | Stuart McLaren <stuart.mclaren@hp.com> | 2015-04-09 13:44:31 +0000 |
commit | d88b4b6d56dd6a265150e8832e52a5ccc9d4bc5d (patch) | |
tree | e8ef4b81dcdf72ef951b91cbea8bfa05fffcb810 | |
parent | 0d7b292b82f98ee004ffbf130865f179e63eefa3 (diff) | |
download | glance-d88b4b6d56dd6a265150e8832e52a5ccc9d4bc5d.tar.gz |
Catch UnknownScheme exception
There are a couple of places where an UnknownScheme
exception could be raises but was not being caught.
Change-Id: I25af9a762c49a1bbea661c3858ffb46cff891ee2
Closes-bug: #1379308
-rw-r--r-- | glance/api/v1/images.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index c4ab7e698..e33b91fbc 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -457,7 +457,8 @@ class Controller(controller.BaseController): except store.NotFound as e: raise HTTPNotFound(explanation=e.msg) except (store.StoreGetNotSupported, - store.StoreRandomGetNotSupported) as e: + store.StoreRandomGetNotSupported, + store.UnknownScheme) as e: raise HTTPBadRequest(explanation=e.msg) image_size = int(image_size) if image_size else None return image_data, image_size @@ -529,9 +530,9 @@ class Controller(controller.BaseController): if location: try: backend = store.get_store_from_location(location) - except store.BadStoreUri: - msg = _("Invalid location: %s") % location - LOG.warn(msg) + except (store.UnknownScheme, store.BadStoreUri): + msg = _("Invalid location %s") % location + LOG.debug(msg) raise HTTPBadRequest(explanation=msg, request=req, content_type="text/plain") @@ -728,7 +729,7 @@ class Controller(controller.BaseController): # disable debug logs. LOG.debug(utils.exception_to_str(e)) raise HTTPNotFound(explanation=e.msg, content_type="text/plain") - except store.BadStoreUri as e: + except (store.UnknownScheme, store.BadStoreUri) as e: # NOTE(rajesht): See above note of store.NotFound LOG.debug(utils.exception_to_str(e)) raise HTTPBadRequest(explanation=e.msg, content_type="text/plain") |