Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

This commit is contained in:
Jake Moshenko 2014-06-27 19:18:35 -04:00
commit e68d6a7302
18 changed files with 261 additions and 9 deletions

View file

@ -1083,13 +1083,32 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name,
def get_repository_images(namespace_name, repository_name):
return (Image
.select(Image, ImageStorage)
.join(Repository)
.switch(Image)
location_list = list((ImageStoragePlacement
.select(ImageStoragePlacement, Image, ImageStorage, ImageStorageLocation)
.join(ImageStorageLocation)
.switch(ImageStoragePlacement)
.join(ImageStorage, JOIN_LEFT_OUTER)
.join(Image)
.join(Repository)
.where(Repository.name == repository_name,
Repository.namespace == namespace_name))
Repository.namespace == namespace_name)))
images = {}
for location in location_list:
# Make sure we're always retrieving the same image object.
image = location.storage.image
image_id = image.docker_image_id
if not image_id in images:
images[image_id] = image
image.storage.locations = set()
else:
image = images[image_id]
# Add the location to the image's locations set.
image.storage.locations.add(location)
return images.values()
def list_repository_tags(namespace_name, repository_name):