v2: add logs around InvalidManifest exception

This commit is contained in:
Jimmy Zelinskie 2016-10-03 10:25:53 -04:00
parent 6c6ef0f22a
commit afa220a744

View file

@ -100,6 +100,7 @@ def write_manifest_by_tagname(namespace_name, repo_name, manifest_ref):
try:
manifest = DockerSchema1Manifest(request.data)
except ManifestException as me:
logger.exception("failed to parse manifest when writing by tagname")
raise ManifestInvalid(detail={'message': 'failed to parse manifest: %s' % me.message})
if manifest.tag != manifest_ref:
@ -118,6 +119,7 @@ def write_manifest_by_digest(namespace_name, repo_name, manifest_ref):
try:
manifest = DockerSchema1Manifest(request.data)
except ManifestException as me:
logger.exception("failed to parse manifest when writing by digest")
raise ManifestInvalid(detail={'message': 'failed to parse manifest: %s' % me.message})
if manifest.digest != manifest_ref:
@ -143,6 +145,7 @@ def _write_manifest(namespace_name, repo_name, manifest):
raise NameInvalid()
if not manifest.layers:
logger.info("manifest provided with no layers")
raise ManifestInvalid(detail={'message': 'manifest does not reference any layers'})
# Ensure all the blobs in the manifest exist.
@ -172,6 +175,7 @@ def _write_manifest(namespace_name, repo_name, manifest):
rewritten_image.parent_image_id,
)
except ManifestException as me:
logger.exception("exception when rewriting v1 metadata")
raise ManifestInvalid(detail={'message': 'failed synthesizing v1 metadata: %s' % me.message})
# Store the manifest pointing to the tag.