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/orphans.py

25 lines
666 B
Python
Raw Normal View History

from data.database import Image
from app import app
live_image_id_set = set()
for image in Image.select():
live_image_id_set.add(image.docker_image_id)
store = app.config['STORAGE']
storage_image_id_set = set()
for customer in store.list_directory('images/'):
for repo in store.list_directory(customer):
for image in store.list_directory(repo):
storage_image_id_set.add(image.split('/')[-1])
orphans = storage_image_id_set.difference(live_image_id_set)
missing_image_data = live_image_id_set.difference(storage_image_id_set)
for orphan in orphans:
print "Orphan: %s" % orphan
for missing in missing_image_data:
print "Missing: %s" % missing