Fix disabled namespace check
This commit is contained in:
parent
cbf0edb164
commit
4a7b4ad06a
9 changed files with 32 additions and 23 deletions
|
@ -257,8 +257,6 @@ class PreOCIModel(RegistryDataInterface):
|
|||
media_type_name=media_type_name))
|
||||
|
||||
yield add_label
|
||||
if labels_to_add:
|
||||
pass
|
||||
|
||||
# TODO: make this truly batch once we've fully transitioned to V2_2 and no longer need
|
||||
# the mapping tables.
|
||||
|
@ -537,6 +535,11 @@ class PreOCIModel(RegistryDataInterface):
|
|||
|
||||
return Manifest.for_tag_manifest(tag_manifest)
|
||||
|
||||
def is_existing_disabled_namespace(self, namespace_name):
|
||||
""" Returns whether the given namespace exists and is disabled. """
|
||||
namespace = model.user.get_namespace_user(namespace_name)
|
||||
return namespace is not None and not namespace.enabled
|
||||
|
||||
def is_namespace_enabled(self, namespace_name):
|
||||
""" Returns whether the given namespace exists and is enabled. """
|
||||
namespace = model.user.get_namespace_user(namespace_name)
|
||||
|
@ -732,9 +735,9 @@ class PreOCIModel(RegistryDataInterface):
|
|||
|
||||
return blob_found.asdict()
|
||||
|
||||
blob_cache_key = cache_key.for_repository_blob(namespace_name, repo_name, blob_digest)
|
||||
blob_cache_key = cache_key.for_repository_blob(namespace_name, repo_name, blob_digest, 2)
|
||||
blob_dict = model_cache.retrieve(blob_cache_key, load_blob)
|
||||
|
||||
|
||||
try:
|
||||
return Blob.from_dict(blob_dict) if blob_dict is not None else None
|
||||
except FromDictionaryException:
|
||||
|
@ -841,7 +844,7 @@ class PreOCIModel(RegistryDataInterface):
|
|||
"""
|
||||
Mounts the blob from another repository into the specified target repository, and adds an
|
||||
expiration before that blob is automatically GCed. This function is useful during push
|
||||
operations if an existing blob from another repositroy is being pushed. Returns False if
|
||||
operations if an existing blob from another repository is being pushed. Returns False if
|
||||
the mounting fails.
|
||||
"""
|
||||
repo = model.repository.lookup_repository(target_repository_ref._db_id)
|
||||
|
@ -862,7 +865,7 @@ class PreOCIModel(RegistryDataInterface):
|
|||
try:
|
||||
tag_manifest = database.TagManifest.get(id=manifest._db_id)
|
||||
except database.TagManifest.DoesNotExist:
|
||||
return None
|
||||
return
|
||||
|
||||
model.tag.set_tag_expiration_for_manifest(tag_manifest, expiration_sec)
|
||||
|
||||
|
|
Reference in a new issue