From 12edeebb0ec416a1258b39148f99eeadb8ef0b4f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 1 Feb 2018 15:20:44 +0100 Subject: [PATCH] syscontainers: read labels from v1Compatibility Images coming from registry.access.redhat.com through "skopeo copy" have this information in the "v1Compatibility" block. Use this information so we can correctly catch "atomic.run". Signed-off-by: Giuseppe Scrivano --- Atomic/syscontainers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Atomic/syscontainers.py b/Atomic/syscontainers.py index e3e71a2..ed2d9c8 100644 --- a/Atomic/syscontainers.py +++ b/Atomic/syscontainers.py @@ -1646,7 +1646,13 @@ Warning: You may want to modify `%s` before starting the service""" % os.path.jo virtual_size = self._get_virtual_size(repo, manifest) if 'Labels' in manifest: labels = manifest['Labels'] - else: + elif 'history' in manifest: + for i in manifest['history']: + if 'v1Compatibility' in i: + config = json.loads(i['v1Compatibility']) + if 'container_config' in config and 'Labels' in config['container_config']: + labels.update(config['container_config']['Labels']) + if labels is None or len(labels) == 0: config = self._image_config(repo, manifest) if config: config = json.loads(config)