Add a check for missing tag manifests

This can occur if a manifest was moved to a different tag
This commit is contained in:
Joseph Schorr 2019-01-23 15:09:17 -05:00
parent 61d00d0c9e
commit 987ffe5614

View file

@ -45,14 +45,17 @@ def verify_backfill(namespace_name):
else:
assert tag.lifetime_end_ms is None
tag_manifest = tag.manifest
repo_tag_manifest = TagManifest.get(tag=repo_tag)
try:
tag_manifest = tag.manifest
repo_tag_manifest = TagManifest.get(tag=repo_tag)
digest_check = tag_manifest.digest == repo_tag_manifest.digest
assert digest_check, _vs(tag_manifest.digest, repo_tag_manifest.digest)
digest_check = tag_manifest.digest == repo_tag_manifest.digest
assert digest_check, _vs(tag_manifest.digest, repo_tag_manifest.digest)
bytes_check = tag_manifest.manifest_bytes == repo_tag_manifest.json_data
assert bytes_check, _vs(tag_manifest.manifest_bytes, repo_tag_manifest.json_data)
bytes_check = tag_manifest.manifest_bytes == repo_tag_manifest.json_data
assert bytes_check, _vs(tag_manifest.manifest_bytes, repo_tag_manifest.json_data)
except TagManifest.DoesNotExist:
logger.info('No tag manifest found for repository tag %s', repo_tag.id)
mli = ManifestLegacyImage.get(manifest=tag_manifest)
assert mli.repository == repo_tag.repository