Merge pull request #3375 from quay/catch-manifest-exceptions
Catch manifest exceptions when backfilling for invalid images
This commit is contained in:
commit
6b30702699
1 changed files with 10 additions and 3 deletions
|
@ -18,7 +18,8 @@ from data.model.user import get_namespace_user
|
||||||
from data.registry_model import pre_oci_model
|
from data.registry_model import pre_oci_model
|
||||||
from data.registry_model.datatypes import Tag as TagDataType
|
from data.registry_model.datatypes import Tag as TagDataType
|
||||||
from image.docker.schema1 import (DockerSchema1Manifest, ManifestException, ManifestInterface,
|
from image.docker.schema1 import (DockerSchema1Manifest, ManifestException, ManifestInterface,
|
||||||
DOCKER_SCHEMA1_SIGNED_MANIFEST_CONTENT_TYPE)
|
DOCKER_SCHEMA1_SIGNED_MANIFEST_CONTENT_TYPE,
|
||||||
|
MalformedSchema1Manifest)
|
||||||
|
|
||||||
from workers.worker import Worker
|
from workers.worker import Worker
|
||||||
from util.bytes import Bytes
|
from util.bytes import Bytes
|
||||||
|
@ -222,8 +223,14 @@ def _get_manifest_id(repositorytag):
|
||||||
|
|
||||||
# Retrieve the TagManifest for the RepositoryTag, backfilling if necessary.
|
# Retrieve the TagManifest for the RepositoryTag, backfilling if necessary.
|
||||||
with db_transaction():
|
with db_transaction():
|
||||||
|
manifest_datatype = None
|
||||||
|
|
||||||
|
try:
|
||||||
manifest_datatype = pre_oci_model.get_manifest_for_tag(repository_tag_datatype,
|
manifest_datatype = pre_oci_model.get_manifest_for_tag(repository_tag_datatype,
|
||||||
backfill_if_necessary=True)
|
backfill_if_necessary=True)
|
||||||
|
except MalformedSchema1Manifest:
|
||||||
|
logger.exception('Error backfilling manifest for tag `%s`', repositorytag.id)
|
||||||
|
|
||||||
if manifest_datatype is None:
|
if manifest_datatype is None:
|
||||||
logger.error('Could not load or backfill manifest for tag `%s`', repositorytag.id)
|
logger.error('Could not load or backfill manifest for tag `%s`', repositorytag.id)
|
||||||
|
|
||||||
|
|
Reference in a new issue