Move size and checksum updates into the metadata call

This commit is contained in:
Joseph Schorr 2014-09-23 15:49:28 -04:00
parent 74e35f917e
commit ec484e3efc
3 changed files with 8 additions and 11 deletions

View file

@ -1206,8 +1206,8 @@ def set_image_size(docker_image_id, namespace_name, repository_name,
return image
def set_image_metadata(docker_image_id, namespace_name, repository_name,
created_date_str, comment, command, parent=None):
def set_image_metadata(docker_image_id, namespace_name, repository_name, created_date_str, comment,
command, uncompressed_size, parent=None):
with config.app_config['DB_TRANSACTION_FACTORY'](db):
query = (Image
.select(Image, ImageStorage)
@ -1223,9 +1223,12 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name,
except Image.DoesNotExist:
raise DataModelException('No image with specified id and repository')
# We cleanup any old checksum in case it's a retry after a fail
fetched.storage.checksum = None
fetched.storage.created = dateutil.parser.parse(created_date_str).replace(tzinfo=None)
fetched.storage.comment = comment
fetched.storage.command = command
fetched.storage.command = command
fetched.storage.uncompressed_size = uncompressed_size
if parent:
fetched.ancestors = '%s%s/' % (parent.ancestors, parent.id)