Eradicate the s3 versions of the checksum and the uploading flag.
This commit is contained in:
parent
af9b0904d9
commit
fb465fd66f
4 changed files with 6 additions and 105 deletions
|
@ -42,22 +42,10 @@ def image_is_uploading(repo_image):
|
|||
if repo_image is None:
|
||||
return False
|
||||
|
||||
if repo_image.storage.uploading is not None:
|
||||
return repo_image.storage.uploading
|
||||
|
||||
logger.warning('Checking legacy upload flag')
|
||||
mark_path = store.image_mark_path(repo_image.storage.uuid)
|
||||
return store.exists(mark_path)
|
||||
return repo_image.storage.uploading
|
||||
|
||||
|
||||
def set_uploading_flag(repo_image, is_image_uploading):
|
||||
if repo_image.storage.uploading is None and not is_image_uploading:
|
||||
logger.warning('Removing legacy upload flag')
|
||||
uuid = repo_image.storage.uuid
|
||||
mark_path = store.image_mark_path(uuid)
|
||||
if store.exists(mark_path):
|
||||
store.remove(mark_path)
|
||||
|
||||
repo_image.storage.uploading = is_image_uploading
|
||||
repo_image.storage.save()
|
||||
|
||||
|
@ -191,14 +179,14 @@ def put_image_layer(namespace, repository, image_id):
|
|||
logger.debug('put_image_layer: Error when computing tarsum '
|
||||
'{0}'.format(e))
|
||||
|
||||
try:
|
||||
checksum = store.get_content(store.image_checksum_path(uuid))
|
||||
except IOError:
|
||||
if repo_image.storage.checksum is None:
|
||||
# We don't have a checksum stored yet, that's fine skipping the check.
|
||||
# Not removing the mark though, image is not downloadable yet.
|
||||
session['checksum'] = csums
|
||||
return make_response('true', 200)
|
||||
|
||||
checksum = repo_image.storage.checksum
|
||||
|
||||
# We check if the checksums provided matches one the one we computed
|
||||
if checksum not in csums:
|
||||
logger.warning('put_image_layer: Wrong checksum')
|
||||
|
@ -357,10 +345,6 @@ def store_checksum(image_storage, checksum):
|
|||
return 'Invalid checksum format'
|
||||
|
||||
# We store the checksum
|
||||
checksum_path = store.image_checksum_path(image_storage.uuid)
|
||||
store.put_content(checksum_path, checksum)
|
||||
|
||||
# And store it in the db
|
||||
image_storage.checksum = checksum
|
||||
image_storage.save()
|
||||
|
||||
|
@ -425,10 +409,8 @@ def put_image_json(namespace, repository, image_id):
|
|||
|
||||
# We cleanup any old checksum in case it's a retry after a fail
|
||||
profile.debug('Cleanup old checksum')
|
||||
try:
|
||||
store.remove(store.image_checksum_path(uuid))
|
||||
except Exception:
|
||||
pass
|
||||
repo_image.storage.checksum = None
|
||||
repo_image.storage.save()
|
||||
|
||||
# If we reach that point, it means that this is a new image or a retry
|
||||
# on a failed push
|
||||
|
|
Reference in a new issue