Update quay sec code to fix problems identified in previous review

- Change get_repository_images_recursive to operate over a single docker image and storage uuid
- Move endpoints/sec to endpoints/secscan
- Change notification system to work with new Quay-sec format

Fixes #768
This commit is contained in:
Joseph Schorr 2015-11-09 17:12:22 -05:00
parent 16c364a90c
commit a69c9e12fd
7 changed files with 146 additions and 79 deletions

View file

@ -12,14 +12,17 @@ def _tag_alive(query, now_ts=None):
(RepositoryTag.lifetime_end_ts > now_ts))
def get_matching_tags(docker_image_ids, *args):
""" Returns a query pointing to all tags that contain the given image(s). """
def get_matching_tags(docker_image_id, storage_uuid, *args):
""" Returns a query pointing to all tags that contain the image with the
given docker_image_id and storage_uuid. """
image_query = image.get_repository_image_and_deriving(docker_image_id, storage_uuid)
return (RepositoryTag
.select(*args)
.distinct()
.join(Image)
.where(Image.id << image.get_repository_images_recursive(docker_image_ids),
RepositoryTag.lifetime_end_ts >> None))
.join(ImageStorage)
.where(Image.id << image_query, RepositoryTag.lifetime_end_ts >> None))
def list_repository_tags(namespace_name, repository_name, include_hidden=False,