Created
September 14, 2018 11:02
-
-
Save odra/62840b7db2931dedd18e15ce36bad594 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
import os | |
images = [] | |
def get_images(path): | |
local_images = [] | |
with open(path) as f: | |
data = json.load(f) | |
i = 0 | |
for item in data['parameters']: | |
v = item.get('value', '') | |
if v.startswith('docker.io'): | |
local_images.append('%s:%s' % (v, data['parameters'][i + 1]['value'])) | |
i = i + 1 | |
return local_images | |
def merge(template_images): | |
for image in template_images: | |
if not image in images: | |
images.append(image) | |
for path in os.listdir('./generated'): | |
if path.endswith('.json'): | |
template_images = get_images('./generated/%s' % path) | |
merge(template_images) | |
for image in images: | |
print 'docker pull %s' % image | |
print '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment