Skip to content

Instantly share code, notes, and snippets.

@odra
Created September 14, 2018 11:02
Show Gist options
  • Save odra/62840b7db2931dedd18e15ce36bad594 to your computer and use it in GitHub Desktop.
Save odra/62840b7db2931dedd18e15ce36bad594 to your computer and use it in GitHub Desktop.
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