Merge pull request #3392 from quay/squashed-additional-logging

Add additional logging information to squashed image exception
This commit is contained in:
Joseph Schorr 2019-03-01 13:04:42 -05:00 committed by GitHub
commit c7fe467cc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,6 @@ class SquashedDockerImageFormatter(TarImageFormatter):
if created is not None:
image_mtime = calendar.timegm(created.utctimetuple())
# Docker import V1 Format (.tar):
# repositories - JSON file containing a repo -> tag -> image map
# {image ID folder}:
@ -86,7 +85,14 @@ class SquashedDockerImageFormatter(TarImageFormatter):
# If the yielded size is more than the estimated size (which is unlikely but possible), then
# raise an exception since the tar header will be wrong.
if yielded_size > estimated_file_size:
message = "Expected %s bytes, found %s bytes" % (estimated_file_size, yielded_size)
leaf_image_id = parsed_manifest.leaf_layer_v1_image_id
message = "For %s/%s:%s (%s:%s): Expected %s bytes, found %s bytes" % (namespace,
repository,
tag,
parsed_manifest.digest,
leaf_image_id,
estimated_file_size,
yielded_size)
raise FileEstimationException(message)
# If the yielded size is less than the estimated size (which is likely), fill the rest with