diff --git a/data/model/legacy.py b/data/model/legacy.py index 85c5456a5..0bbca5c9e 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -1151,7 +1151,7 @@ def garbage_collect_repository(namespace_name, repository_name): for placement in storage.imagestorageplacement_set: location_name = placement.location.name placement.delete_instance() - config.store.remove(location_name, image_path) + config.store.remove({location_name}, image_path) storage.delete_instance() diff --git a/endpoints/registry.py b/endpoints/registry.py index 9b1aacbe4..2d4eeca18 100644 --- a/endpoints/registry.py +++ b/endpoints/registry.py @@ -388,12 +388,13 @@ def put_image_json(namespace, repository, image_id): parent_image = model.get_repo_image(namespace, repository, parent_id) parent_uuid = parent_image and parent_image.storage.uuid + parent_locations = parent_image and parent_image.storage.locations if parent_id: profile.debug('Looking up parent image data') if (parent_id and not - store.exists(parent_image.storage.locations, store.image_json_path(parent_uuid))): + store.exists(parent_locations, store.image_json_path(parent_uuid))): abort(400, 'Image %(image_id)s depends on non existing parent image %(parent_id)s', issue='invalid-request', image_id=image_id, parent_id=parent_id) @@ -428,7 +429,7 @@ def put_image_json(namespace, repository, image_id): profile.debug('Generating image ancestry') generate_ancestry(image_id, uuid, repo_image.storage.locations, parent_id, parent_uuid, - parent_image.storage.locations) + parent_locations) profile.debug('Done') return make_response('true', 200) diff --git a/storage/basestorage.py b/storage/basestorage.py index 4494eb3b5..b554845b4 100644 --- a/storage/basestorage.py +++ b/storage/basestorage.py @@ -4,6 +4,18 @@ import tempfile class StoragePaths(object): shared_images = 'sharedimages' + @staticmethod + def temp_store_handler(): + tmpf = tempfile.TemporaryFile() + + def fn(buf): + try: + tmpf.write(buf) + except IOError: + pass + + return tmpf, fn + def image_path(self, storage_uuid): return '{0}/{1}/'.format(self.shared_images, storage_uuid) @@ -42,18 +54,6 @@ class BaseStorage(StoragePaths): # Set the IO buffer to 64kB buffer_size = 64 * 1024 - @staticmethod - def temp_store_handler(): - tmpf = tempfile.TemporaryFile() - - def fn(buf): - try: - tmpf.write(buf) - except IOError: - pass - - return tmpf, fn - def get_direct_download_url(self, path, expires_in=60): return None