Merge pull request #3371 from quay/further-storage-fixes
Make absolutely sure we don't overwrite an existing storage checksum
This commit is contained in:
commit
410aa151db
2 changed files with 6 additions and 3 deletions
|
@ -52,6 +52,8 @@ def store_blob_record_and_temp_link(namespace, repo_name, blob_digest, location_
|
|||
link_expiration_s, uncompressed_byte_count=None):
|
||||
""" Store a record of the blob and temporarily link it to the specified repository.
|
||||
"""
|
||||
assert blob_digest
|
||||
|
||||
with db_transaction():
|
||||
try:
|
||||
storage = ImageStorage.get(content_checksum=blob_digest)
|
||||
|
@ -183,6 +185,10 @@ def get_or_create_shared_blob(digest, byte_data, storage):
|
|||
accessible, such as the special empty gzipped tar layer that Docker
|
||||
no longer pushes to us.
|
||||
"""
|
||||
assert digest
|
||||
assert byte_data is not None
|
||||
assert storage
|
||||
|
||||
try:
|
||||
return ImageStorage.get(content_checksum=digest, uploading=False)
|
||||
except ImageStorage.DoesNotExist:
|
||||
|
|
|
@ -341,9 +341,6 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name, created
|
|||
|
||||
# We cleanup any old checksum in case it's a retry after a fail
|
||||
fetched.v1_checksum = None
|
||||
fetched.storage.content_checksum = None
|
||||
fetched.storage.save()
|
||||
|
||||
fetched.comment = comment
|
||||
fetched.command = command
|
||||
fetched.v1_json_metadata = v1_json_metadata
|
||||
|
|
Reference in a new issue