Add additional logging information to squashed image exception

This commit is contained in:
Joseph Schorr 2019-03-01 12:53:03 -05:00
parent 9d3543a353
commit ef13fd06e0

View file

@ -35,7 +35,6 @@ class SquashedDockerImageFormatter(TarImageFormatter):
if created is not None: if created is not None:
image_mtime = calendar.timegm(created.utctimetuple()) image_mtime = calendar.timegm(created.utctimetuple())
# Docker import V1 Format (.tar): # Docker import V1 Format (.tar):
# repositories - JSON file containing a repo -> tag -> image map # repositories - JSON file containing a repo -> tag -> image map
# {image ID folder}: # {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 # 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. # raise an exception since the tar header will be wrong.
if yielded_size > estimated_file_size: 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) raise FileEstimationException(message)
# If the yielded size is less than the estimated size (which is likely), fill the rest with # If the yielded size is less than the estimated size (which is likely), fill the rest with