Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'6a630e46a580e8b2327fc45d9d1f4734ccaeb0afaa094e0f45722a5f1c91e009/layer.tar',
]
'RepoTags': ['user/image:version'],
"Parent": "sha256:5a00e6ccb81ef304e1bb9995ea9605f199aa96659a44237d58ca96982daf9af8"
},
{'Config': '7043867122e704683c9eaccd7e26abcd5bc9fea413ddfeae66166697bdcbde1f.json',
'Layers': [
'768d4f50f65f00831244703e57f64134771289e3de919a576441c9140e037ea2/layer.tar',
'6a630e46a580e8b2327fc45d9d1f4734ccaeb0afaa094e0f45722a5f1c91e009/layer.tar',
]
'RepoTags': ['user/image:version']
},
]
"""
manifest_file = join(repo_dir, MANIFEST_JSON_FILE)
manifest = load_json(manifest_file)
for image_config in manifest:
config_file = image_config.get('Config')
config_file = join(repo_dir, config_file)
if not exists(config_file):
# FIXME: orphaned manifest entry
image_id = file_base_name(config_file)
image = Image(image_id=image_id)
assert image.image_id not in self.images_by_id
self.images_by_id[image.image_id] = image
continue
image = Image.load_image_config(config_file)
assert image.image_id not in self.images_by_id
def populate(self, base_dir):
"""
Collect the `base_dir` for image repositories.
"""
for fil in fileutils.file_iter(base_dir):
# FIXME: we are only looking at V11 repos for now.
fn = fileutils.file_name(fil)
if not fn == MANIFEST_JSON_FILE:
continue
rd = parent_directory(fil)
repo = Repository()
repo.load_manifest(rd)
logger_debug('populate: path: %(fn)r' % locals())
self.repositories[rd] = repo