Add a script to backfill the sizes of existing images.

This commit is contained in:
yackob03 2014-01-03 17:05:47 -05:00
parent e7904f0a9e
commit 623e2591e7

16
tools/backfillsizes.py Normal file
View file

@ -0,0 +1,16 @@
from data.database import Image
from app import app
store = app.config['STORAGE']
for image in Image.select():
if image.image_size == None:
image_path = store.image_layer_path(image.repository.namespace,
image.repository.name,
image.docker_image_id)
size = store.get_size(image_path)
print 'Setting image %s size to: %s' % (image.docker_image_id, size)
image.image_size = size
image.save()