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

17 lines
536 B
Python
Raw Normal View History

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()