Have the layer PUT method calculate the uncompressed size in realtime, as trusting the JSON is fraught with complications

This commit is contained in:
Joseph Schorr 2014-09-29 17:00:47 -04:00
parent 7fd3c7d31b
commit 474add0fb1
3 changed files with 48 additions and 5 deletions

View file

@ -1251,7 +1251,7 @@ def set_image_size(docker_image_id, namespace_name, repository_name,
def set_image_metadata(docker_image_id, namespace_name, repository_name, created_date_str, comment,
command, uncompressed_size, parent=None):
command, parent=None):
with config.app_config['DB_TRANSACTION_FACTORY'](db):
query = (Image
.select(Image, ImageStorage)
@ -1272,7 +1272,6 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name, created
fetched.storage.created = dateutil.parser.parse(created_date_str).replace(tzinfo=None)
fetched.storage.comment = comment
fetched.storage.command = command
fetched.storage.uncompressed_size = uncompressed_size
if parent:
fetched.ancestors = '%s%s/' % (parent.ancestors, parent.id)