Fixes for the uncompressed size backfill script.

This commit is contained in:
Jake Moshenko 2014-09-23 16:06:38 -04:00
parent ec484e3efc
commit 98d8e0fe37
2 changed files with 55 additions and 15 deletions

View file

@ -83,6 +83,10 @@ class InvalidBuildTriggerException(DataModelException):
pass
class InvalidImageException(DataModelException):
pass
class TooManyUsersException(DataModelException):
pass
@ -1180,6 +1184,23 @@ def find_create_or_link_image(docker_image_id, repository, username, translation
return new_image
def get_storage_by_uuid(storage_uuid):
placements = list(ImageStoragePlacement
.select(ImageStoragePlacement, ImageStorage, ImageStorageLocation)
.join(ImageStorageLocation)
.switch(ImageStoragePlacement)
.join(ImageStorage)
.where(ImageStorage.uuid == storage_uuid))
if not placements:
raise InvalidImageException('No storage found with uuid: %s', storage_uuid)
found = placements[0].storage
found.locations = {placement.location.name for placement in placements}
return found
def set_image_size(docker_image_id, namespace_name, repository_name,
image_size):
try: