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) if store.exists(image_path): size = store.get_size(image_path) print 'Setting image %s size to: %s' % (image.docker_image_id, size) image.image_size = size image.save()