Fix bugs with pushing, pulling, and deleting.
This commit is contained in:
parent
bf98575feb
commit
bf0e01fba5
3 changed files with 16 additions and 15 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Reference in a new issue