Stop writing to deprecated columns for image data.

This commit is contained in:
Jake Moshenko 2015-09-17 15:23:33 -04:00
parent 6bf2ddb762
commit 9da64f3aba
9 changed files with 13 additions and 39 deletions

View file

@ -286,24 +286,15 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name, created
# We cleanup any old checksum in case it's a retry after a fail
fetched.storage.checksum = None
now = datetime.now()
# TODO stop writing to storage when all readers are removed
fetched.storage.created = now
fetched.created = now
fetched.created = datetime.now()
if created_date_str is not None:
try:
# TODO stop writing to storage fields when all readers are removed
parsed_created_time = dateutil.parser.parse(created_date_str).replace(tzinfo=None)
fetched.created = parsed_created_time
fetched.storage.created = parsed_created_time
fetched.created = dateutil.parser.parse(created_date_str).replace(tzinfo=None)
except:
# parse raises different exceptions, so we cannot use a specific kind of handler here.
pass
# TODO stop writing to storage fields when all readers are removed
fetched.storage.comment = comment
fetched.storage.command = command
fetched.comment = comment
fetched.command = command
fetched.v1_json_metadata = v1_json_metadata
@ -347,17 +338,11 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
.where(Image.id << ancestors)
.scalar())
# TODO stop writing to storage when all readers are removed
if ancestor_size is not None:
# total_size = image_size + parent_image.storage.aggregate_size
total_size = ancestor_size + image_size
image.storage.aggregate_size = total_size
image.aggregate_size = total_size
image.aggregate_size = ancestor_size + image_size
except Image.DoesNotExist:
pass
else:
# TODO stop writing to storage when all readers are removed
image.storage.aggregate_size = image_size
image.aggregate_size = image_size
image.storage.save()