From b6272c89341e85542203f601709e27c6e0f6d3e7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 19 Feb 2019 15:36:19 -0500 Subject: [PATCH] Catch manifest exceptions when backfilling for invalid images --- workers/tagbackfillworker.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/workers/tagbackfillworker.py b/workers/tagbackfillworker.py index 827f5f9de..1e3c12dd5 100644 --- a/workers/tagbackfillworker.py +++ b/workers/tagbackfillworker.py @@ -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 = pre_oci_model.get_manifest_for_tag(repository_tag_datatype, - backfill_if_necessary=True) + 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)