Add additional assertions and further checks in storage code
This commit is contained in:
parent
6b30702699
commit
693e47e063
3 changed files with 8 additions and 2 deletions
|
@ -15,6 +15,7 @@ logger = logging.getLogger(__name__)
|
|||
def get_repository_blob_by_digest(repository, blob_digest):
|
||||
""" Find the content-addressable blob linked to the specified repository.
|
||||
"""
|
||||
assert blob_digest
|
||||
try:
|
||||
storage = (ImageStorage
|
||||
.select(ImageStorage.uuid)
|
||||
|
@ -32,6 +33,7 @@ def get_repository_blob_by_digest(repository, blob_digest):
|
|||
def get_repo_blob_by_digest(namespace, repo_name, blob_digest):
|
||||
""" Find the content-addressable blob linked to the specified repository.
|
||||
"""
|
||||
assert blob_digest
|
||||
try:
|
||||
storage = (ImageStorage
|
||||
.select(ImageStorage.uuid)
|
||||
|
@ -81,6 +83,8 @@ def temp_link_blob(namespace, repo_name, blob_digest, link_expiration_s):
|
|||
""" Temporarily links to the blob record from the given namespace. If the blob record is not
|
||||
found, return None.
|
||||
"""
|
||||
assert blob_digest
|
||||
|
||||
with db_transaction():
|
||||
try:
|
||||
storage = ImageStorage.get(content_checksum=blob_digest)
|
||||
|
@ -172,6 +176,7 @@ def get_shared_blob(digest):
|
|||
globally accessible, such as the special empty gzipped tar layer that Docker
|
||||
no longer pushes to us.
|
||||
"""
|
||||
assert digest
|
||||
try:
|
||||
return ImageStorage.get(content_checksum=digest, uploading=False)
|
||||
except ImageStorage.DoesNotExist:
|
||||
|
|
Reference in a new issue