Fix bug in dockerloadformat and make sure we handle exceptions properly in the verb call
This commit is contained in:
parent
c34a8b6727
commit
d16fdde528
4 changed files with 35 additions and 7 deletions
|
@ -26,7 +26,6 @@ def build_docker_load_stream(namespace, repository, tag, synthetic_image_id,
|
|||
|
||||
def _import_format_generator(namespace, repository, tag, synthetic_image_id,
|
||||
layer_json, get_image_iterator, get_layer_iterator):
|
||||
|
||||
# Docker import V1 Format (.tar):
|
||||
# repositories - JSON file containing a repo -> tag -> image map
|
||||
# {image ID folder}:
|
||||
|
@ -69,7 +68,7 @@ def _import_format_generator(namespace, repository, tag, synthetic_image_id,
|
|||
yielded_size += len(entry)
|
||||
|
||||
# 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:
|
||||
raise FileEstimationException()
|
||||
|
||||
|
@ -114,6 +113,7 @@ def _tar_file_padding(length):
|
|||
if length % 512 != 0:
|
||||
return '\0' * (512 - (length % 512))
|
||||
|
||||
return ''
|
||||
|
||||
def _tar_file_header(name, file_size):
|
||||
info = tarfile.TarInfo(name=name)
|
||||
|
|
Reference in a new issue