Fix unsaved exception in v1 API controller
When an exception occurs during exception handling, it lose the information of the first exception. We should use the excutils.save_and_reraise_exception() in this case. Change-Id: I467c9627fa661421926d50c3e894f80d9b75baa2 Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
This commit is contained in:
parent
a62cdcefb0
commit
c725a56962
@ -1031,10 +1031,10 @@ class Controller(controller.BaseController):
|
||||
if image['location']:
|
||||
upload_utils.initiate_deletion(req, image['location'], id,
|
||||
CONF.delayed_delete)
|
||||
except Exception as e:
|
||||
registry.update_image_metadata(req.context, id,
|
||||
{'status': ori_status})
|
||||
raise e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
registry.update_image_metadata(req.context, id,
|
||||
{'status': ori_status})
|
||||
registry.delete_image_metadata(req.context, id)
|
||||
except exception.NotFound as e:
|
||||
msg = _("Failed to find image to delete: %(e)s") % {'e': e}
|
||||
|
Loading…
x
Reference in New Issue
Block a user