This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/tools/backfill_commands.py

20 lines
692 B
Python
Raw Normal View History

from data.database import Image
from app import app
import json
store = app.config['STORAGE']
for image in Image.select():
if image.command == None:
image_json_path = store.image_json_path(image.repository.namespace,
image.repository.name,
image.docker_image_id)
if store.exists(image_json_path):
data = json.loads(store.get_content(image_json_path))
command_list = data.get('container_config', {}).get('Cmd', None)
command = json.dumps(command_list) if command_list else None
print 'Setting command to: %s' % command
image.command = command
image.save()