Merge pull request #3375 from quay/catch-manifest-exceptions

Catch manifest exceptions when backfilling for invalid images
This commit is contained in:
Joseph Schorr 2019-02-19 15:39:52 -05:00 committed by GitHub
commit 6b30702699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,8 @@ from data.model.user import get_namespace_user
from data.registry_model import pre_oci_model
from data.registry_model.datatypes import Tag as TagDataType
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 util.bytes import Bytes
@ -222,8 +223,14 @@ def _get_manifest_id(repositorytag):
# Retrieve the TagManifest for the RepositoryTag, backfilling if necessary.
with db_transaction():
manifest_datatype = None
try:
manifest_datatype = pre_oci_model.get_manifest_for_tag(repository_tag_datatype,
backfill_if_necessary=True)
except MalformedSchema1Manifest:
logger.exception('Error backfilling manifest for tag `%s`', repositorytag.id)
if manifest_datatype is None:
logger.error('Could not load or backfill manifest for tag `%s`', repositorytag.id)