Fix port mapping for ACI conversion from newer Docker manifests.

This commit is contained in:
Jake Moshenko 2016-12-20 14:01:06 -05:00
parent a2ac62f5ce
commit d58a1ca35a
7 changed files with 149 additions and 42 deletions

View file

@ -28,8 +28,8 @@ class SquashedDockerImageFormatter(TarImageFormatter):
# daemon dies when trying to load the entire tar into memory.
SIZE_MULTIPLIER = 1.2
def stream_generator(self, namespace, repository, tag, repo_image, synthetic_image_id,
get_image_iterator, get_layer_iterator):
def stream_generator(self, repo_image, tag, synthetic_image_id, get_image_iterator,
get_layer_iterator):
image_mtime = 0
created = next(get_image_iterator()).v1_metadata.created
if created is not None:
@ -50,6 +50,8 @@ class SquashedDockerImageFormatter(TarImageFormatter):
hostname = app.config['SERVER_HOSTNAME']
repositories = {}
namespace = repo_image.repository.namespace_name
repository = repo_image.repository.name
repositories[hostname + '/' + namespace + '/' + repository] = synthetic_layer_info
yield self.tar_file('repositories', json.dumps(repositories), mtime=image_mtime)
@ -74,7 +76,8 @@ class SquashedDockerImageFormatter(TarImageFormatter):
estimated_file_size += image.blob.uncompressed_size
else:
image_json = image.compat_metadata
estimated_file_size += image_json.get('Size', 0) * SquashedDockerImageFormatter.SIZE_MULTIPLIER
estimated_file_size += (image_json.get('Size', 0) *
SquashedDockerImageFormatter.SIZE_MULTIPLIER)
# Make sure the estimated file size is an integer number of bytes.
estimated_file_size = int(math.ceil(estimated_file_size))