WIP: Towards sec demo
This commit is contained in:
parent
fb3d0fa27d
commit
407eaae137
6 changed files with 164 additions and 14 deletions
|
@ -12,6 +12,19 @@ from data.database import (Image, Repository, ImageStoragePlacement, Namespace,
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_repository_images_recursive(docker_image_ids):
|
||||
""" Returns a query matching the given docker image IDs, along with any which have the image IDs
|
||||
as parents.
|
||||
|
||||
Note: This is a DB intensive operation and should be used sparingly.
|
||||
"""
|
||||
inner_images = Image.select('%/' + Image.id + '/%').where(Image.docker_image_id << docker_image_ids)
|
||||
|
||||
images = Image.select(Image.id).where(Image.docker_image_id << docker_image_ids)
|
||||
recursive_images = Image.select(Image.id).where(Image.ancestors ** inner_images)
|
||||
return recursive_images | images
|
||||
|
||||
|
||||
def get_parent_images(namespace_name, repository_name, image_obj):
|
||||
""" Returns a list of parent Image objects in chronilogical order. """
|
||||
parents = image_obj.ancestors
|
||||
|
|
Reference in a new issue