25 lines
666 B
Python
25 lines
666 B
Python
|
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
|