Merge pull request #434 from mjibson/abort-failed-s3-uploads
Return an error on failed S3 uploads
This commit is contained in:
commit
1e1711aae9
2 changed files with 7 additions and 2 deletions
|
@ -252,7 +252,11 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
|
|
||||||
# Stream write the data to storage.
|
# Stream write the data to storage.
|
||||||
with database.CloseForLongOperation(app.config):
|
with database.CloseForLongOperation(app.config):
|
||||||
store.stream_write(repo_image.storage.locations, layer_path, sr)
|
try:
|
||||||
|
store.stream_write(repo_image.storage.locations, layer_path, sr)
|
||||||
|
except IOError:
|
||||||
|
logger.exception('Exception when writing image data')
|
||||||
|
abort(520, 'Image %(image_id)s could not be written. Please try again.', image_id=image_id)
|
||||||
|
|
||||||
# Append the computed checksum.
|
# Append the computed checksum.
|
||||||
csums = []
|
csums = []
|
||||||
|
|
|
@ -167,7 +167,8 @@ class _CloudStorage(BaseStorage):
|
||||||
except IOError:
|
except IOError:
|
||||||
app.metric_queue.put('MultipartUploadFailure', 1)
|
app.metric_queue.put('MultipartUploadFailure', 1)
|
||||||
mp.cancel_upload()
|
mp.cancel_upload()
|
||||||
break
|
raise
|
||||||
|
|
||||||
app.metric_queue.put('MultipartUploadSuccess', 1)
|
app.metric_queue.put('MultipartUploadSuccess', 1)
|
||||||
mp.complete_upload()
|
mp.complete_upload()
|
||||||
|
|
||||||
|
|
Reference in a new issue