From ef13fd06e0b19eaba6547c2e9dbd36efccd24336 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 1 Mar 2019 12:53:03 -0500 Subject: [PATCH] Add additional logging information to squashed image exception --- image/docker/squashed.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/image/docker/squashed.py b/image/docker/squashed.py index ef6299009..a5f5f0c64 100644 --- a/image/docker/squashed.py +++ b/image/docker/squashed.py @@ -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