Merge pull request #1924 from coreos-inc/manifestlogs
v2: better manifest error messages
This commit is contained in:
commit
671dc73b82
1 changed files with 7 additions and 3 deletions
|
@ -100,7 +100,8 @@ def write_manifest_by_tagname(namespace_name, repo_name, manifest_ref):
|
|||
try:
|
||||
manifest = DockerSchema1Manifest(request.data)
|
||||
except ManifestException as me:
|
||||
raise ManifestInvalid(detail={'message': me.message})
|
||||
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:
|
||||
raise TagInvalid()
|
||||
|
@ -118,7 +119,8 @@ def write_manifest_by_digest(namespace_name, repo_name, manifest_ref):
|
|||
try:
|
||||
manifest = DockerSchema1Manifest(request.data)
|
||||
except ManifestException as me:
|
||||
raise ManifestInvalid(detail={'message': me.message})
|
||||
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:
|
||||
raise ManifestInvalid(detail={'message': 'manifest digest mismatch'})
|
||||
|
@ -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,7 +175,8 @@ def _write_manifest(namespace_name, repo_name, manifest):
|
|||
rewritten_image.parent_image_id,
|
||||
)
|
||||
except ManifestException as me:
|
||||
raise ManifestInvalid(detail={'message': me.message})
|
||||
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.
|
||||
leaf_layer_id = rewritten_images[-1].image_id
|
||||
|
|
Reference in a new issue