Merge "Fix 500 from stage call on non-existing image"
This commit is contained in:
commit
deff5cd876
|
@ -304,6 +304,9 @@ class ImageDataController(object):
|
|||
msg = _("The image %s has data on staging") % image_id
|
||||
raise webob.exc.HTTPConflict(explanation=msg)
|
||||
|
||||
except exception.NotFound as e:
|
||||
raise webob.exc.HTTPNotFound(explanation=e.msg)
|
||||
|
||||
except glance_store.StorageFull as e:
|
||||
msg = _("Image storage media "
|
||||
"is full: %s") % encodeutils.exception_to_unicode(e)
|
||||
|
|
|
@ -473,6 +473,12 @@ class TestImagesController(base.StoreClearingUnitTest):
|
|||
request, image_id, 'YYYYYYY', 7)
|
||||
self.assertEqual('queued', self.image_repo.saved_image.status)
|
||||
|
||||
def test_image_stage_non_existent_image(self):
|
||||
request = unit_test_utils.get_fake_request()
|
||||
self.image_repo.result = exception.NotFound()
|
||||
self.assertRaises(webob.exc.HTTPNotFound, self.controller.stage,
|
||||
request, str(uuid.uuid4()), 'ABC', 3)
|
||||
|
||||
|
||||
class TestImageDataDeserializer(test_utils.BaseTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue