Fixes issue with exceptions getting eaten in image/s3.py if there is a failure during register. The variables referenced with locals() were actually out of scope.
This commit is contained in:
@@ -193,6 +193,8 @@ class S3ImageService(service.BaseImageService):
|
||||
|
||||
def delayed_create():
|
||||
"""This handles the fetching and decrypting of the part files."""
|
||||
log_vars = {'image_location': image_location,
|
||||
'image_path': image_path}
|
||||
metadata['properties']['image_state'] = 'downloading'
|
||||
self.service.update(context, image_id, metadata)
|
||||
|
||||
@@ -213,11 +215,11 @@ class S3ImageService(service.BaseImageService):
|
||||
shutil.copyfileobj(part, combined)
|
||||
|
||||
except Exception:
|
||||
LOG.error(_("Failed to download %(image_location)s "
|
||||
"to %(image_path)s"), locals())
|
||||
LOG.exception(_("Failed to download %(image_location)s "
|
||||
"to %(image_path)s"), log_vars)
|
||||
metadata['properties']['image_state'] = 'failed_download'
|
||||
self.service.update(context, image_id, metadata)
|
||||
raise
|
||||
return
|
||||
|
||||
metadata['properties']['image_state'] = 'decrypting'
|
||||
self.service.update(context, image_id, metadata)
|
||||
@@ -237,11 +239,11 @@ class S3ImageService(service.BaseImageService):
|
||||
encrypted_iv, cloud_pk,
|
||||
dec_filename)
|
||||
except Exception:
|
||||
LOG.error(_("Failed to decrypt %(image_location)s "
|
||||
"to %(image_path)s"), locals())
|
||||
LOG.exception(_("Failed to decrypt %(image_location)s "
|
||||
"to %(image_path)s"), log_vars)
|
||||
metadata['properties']['image_state'] = 'failed_decrypt'
|
||||
self.service.update(context, image_id, metadata)
|
||||
raise
|
||||
return
|
||||
|
||||
metadata['properties']['image_state'] = 'untarring'
|
||||
self.service.update(context, image_id, metadata)
|
||||
@@ -249,11 +251,11 @@ class S3ImageService(service.BaseImageService):
|
||||
try:
|
||||
unz_filename = self._untarzip_image(image_path, dec_filename)
|
||||
except Exception:
|
||||
LOG.error(_("Failed to untar %(image_location)s "
|
||||
"to %(image_path)s"), locals())
|
||||
LOG.exception(_("Failed to untar %(image_location)s "
|
||||
"to %(image_path)s"), log_vars)
|
||||
metadata['properties']['image_state'] = 'failed_untar'
|
||||
self.service.update(context, image_id, metadata)
|
||||
raise
|
||||
return
|
||||
|
||||
metadata['properties']['image_state'] = 'uploading'
|
||||
self.service.update(context, image_id, metadata)
|
||||
@@ -262,11 +264,11 @@ class S3ImageService(service.BaseImageService):
|
||||
self.service.update(context, image_id,
|
||||
metadata, image_file)
|
||||
except Exception:
|
||||
LOG.error(_("Failed to upload %(image_location)s "
|
||||
"to %(image_path)s"), locals())
|
||||
LOG.exception(_("Failed to upload %(image_location)s "
|
||||
"to %(image_path)s"), log_vars)
|
||||
metadata['properties']['image_state'] = 'failed_upload'
|
||||
self.service.update(context, image_id, metadata)
|
||||
raise
|
||||
return
|
||||
|
||||
metadata['properties']['image_state'] = 'available'
|
||||
metadata['status'] = 'active'
|
||||
|
||||
Reference in New Issue
Block a user