From fa55169c35afba5921f522a1f352da48a24a057f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 16 Jan 2015 18:23:40 -0500 Subject: [PATCH] - Fix bug in tarlayerformat when dealing with larger headers - Fix bug around entry points and config in the ACI converter --- formats/aci.py | 4 ++-- util/tarlayerformat.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/formats/aci.py b/formats/aci.py index ea108830f..156858ed2 100644 --- a/formats/aci.py +++ b/formats/aci.py @@ -132,7 +132,6 @@ class ACIImage(TarImageFormatter): """ Builds an ACI manifest from the docker layer data. """ config = docker_layer_data.get('config', {}) - config.update(docker_layer_data.get('container_config', {})) source_url = "%s://%s/%s/%s:%s" % (app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'], @@ -140,7 +139,8 @@ class ACIImage(TarImageFormatter): # ACI requires that the execution command be absolutely referenced. Therefore, if we find # a relative command, we give it as an argument to /bin/sh to resolve and execute for us. - exec_path = config.get('Cmd', []) + entrypoint = config.get('Entrypoint') or [] + exec_path = entrypoint + config.get('Cmd') or [] if exec_path and not exec_path[0].startswith('/'): exec_path = ['/bin/sh', '-c', '""%s""' % ' '.join(exec_path)] diff --git a/util/tarlayerformat.py b/util/tarlayerformat.py index 2d7a6b52d..3d6ddd94b 100644 --- a/util/tarlayerformat.py +++ b/util/tarlayerformat.py @@ -1,5 +1,6 @@ import os import tarfile +import copy class TarLayerReadException(Exception): """ Exception raised when reading a layer has failed. """ @@ -38,7 +39,7 @@ class TarLayerFormat(object): # Yield the tar header. if self.path_prefix: - clone = tarfile.TarInfo.frombuf(tar_info.tobuf()) + clone = copy.deepcopy(tar_info) clone.name = os.path.join(self.path_prefix, clone.name) yield clone.tobuf() else: