securityscanner: add a min image id option

This will enable us to force some instances of the securityworker to
scan only new images.
This commit is contained in:
Jimmy Zelinskie 2017-03-03 13:55:25 -05:00
parent aa2f88d321
commit 4ed0cdda14
4 changed files with 12 additions and 6 deletions

View file

@ -495,10 +495,13 @@ def get_image_id():
return Image.id
def get_images_eligible_for_scan(clair_version):
def get_images_eligible_for_scan(clair_version, min_id=None):
""" Returns a query that gives all images eligible for a clair scan """
return (get_image_with_storage_and_parent_base()
.where(Image.security_indexed_engine < clair_version))
query = (get_image_with_storage_and_parent_base()
.where(Image.security_indexed_engine < clair_version))
if min_id is not None:
query = query.where(Image.id >= min_id)
return query
def get_image_with_storage_and_parent_base():