diff options
| author | Mark Washenberger <mark.washenberger@rackspace.com> | 2012-03-02 15:57:55 -0500 |
|---|---|---|
| committer | Mark Washenberger <mark.washenberger@rackspace.com> | 2012-03-06 13:24:08 -0500 |
| commit | f56cef93ea6e3746a17152bcd1850ccf4b3dad3d (patch) | |
| tree | 3ae7a3c658ea392b5e1533a0eecd769743c74159 /nova/api | |
| parent | 0d78045e72efe7313ca54e726dd403793eb30b52 (diff) | |
| download | nova-f56cef93ea6e3746a17152bcd1850ccf4b3dad3d.tar.gz nova-f56cef93ea6e3746a17152bcd1850ccf4b3dad3d.tar.xz nova-f56cef93ea6e3746a17152bcd1850ccf4b3dad3d.zip | |
Better glance exception handling
- Adds a conversion step that turns glance exceptions into nova
exceptions
- Converts Invalid to HTTPBadRequest in /images and /images/detail,
fixing bug 944846
- Makes stub glance client return glance exceptions instead of nova
exceptions
- Rebased off of http://review.openstack.org/4788 to pick up
MissingCredentialError handling as well, and added a test
- A few small, miscellaneous testing fixes for issues I noticed
Change-Id: I88eebfe7a7ac21cc5cd84ad84d64b311ddccf91e
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/images.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 1a957bc56..eceee6651 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -171,8 +171,11 @@ class Controller(wsgi.Controller): for key, val in page_params.iteritems(): params[key] = val - images = self._image_service.index(context, filters=filters, - **page_params) + try: + images = self._image_service.index(context, filters=filters, + **page_params) + except exception.Invalid as e: + raise webob.exc.HTTPBadRequest(explanation=str(e)) return self._view_builder.index(req, images) @wsgi.serializers(xml=ImagesTemplate) @@ -188,8 +191,11 @@ class Controller(wsgi.Controller): page_params = common.get_pagination_params(req) for key, val in page_params.iteritems(): params[key] = val - images = self._image_service.detail(context, filters=filters, - **page_params) + try: + images = self._image_service.detail(context, filters=filters, + **page_params) + except exception.Invalid as e: + raise webob.exc.HTTPBadRequest(explanation=str(e)) return self._view_builder.detail(req, images) |
