Fix another image storage test. Reverse a test to make the conditional smaller.
This commit is contained in:
parent
369417c3ad
commit
50d130f199
1 changed files with 6 additions and 6 deletions
|
@ -925,7 +925,7 @@ def set_image_size(docker_image_id, namespace_name, repository_name,
|
|||
except Image.DoesNotExist:
|
||||
raise DataModelException('No image with specified id and repository')
|
||||
|
||||
if image.storage:
|
||||
if image.storage and image.storage.id:
|
||||
image.storage.image_size = image_size
|
||||
image.storage.save()
|
||||
else:
|
||||
|
@ -1012,15 +1012,15 @@ def garbage_collect_repository(namespace_name, repository_name):
|
|||
for image_id_to_remove in to_remove:
|
||||
image_to_remove = all_images[image_id_to_remove]
|
||||
|
||||
if not image_to_remove.storage or not image_to_remove.storage.id:
|
||||
if image_to_remove.storage and image_to_remove.storage.id:
|
||||
logger.debug('Adding image storage to the gc list: %s',
|
||||
image_to_remove.storage.uuid)
|
||||
uuids_to_check_for_gc.add(image_to_remove.storage.uuid)
|
||||
else:
|
||||
image_path = store.image_path(namespace_name, repository_name,
|
||||
image_to_remove.docker_image_id, None)
|
||||
logger.debug('Deleting image storage: %s', image_path)
|
||||
store.remove(image_path)
|
||||
else:
|
||||
logger.debug('Adding image storage to the gc list: %s',
|
||||
image_to_remove.storage.uuid)
|
||||
uuids_to_check_for_gc.add(image_to_remove.storage.uuid)
|
||||
|
||||
image_to_remove.delete_instance()
|
||||
|
||||
|
|
Reference in a new issue