diff --git a/data/model/image.py b/data/model/image.py index f3291a242..95ee563c9 100644 --- a/data/model/image.py +++ b/data/model/image.py @@ -492,7 +492,6 @@ def get_secscan_candidates(engine_version, batch_size): .switch(Image) .join(ImageStorage) .where(Image.security_indexed_engine < engine_version, - Parent.security_indexed == True, Parent.security_indexed_engine >= engine_version, ImageStorage.uploading == False) .limit(batch_size*10)) diff --git a/workers/securityworker.py b/workers/securityworker.py index 968de7cbd..91a182663 100644 --- a/workers/securityworker.py +++ b/workers/securityworker.py @@ -163,6 +163,12 @@ class SecurityWorker(Worker): logger.debug('Found %d images to index', len(images)) for image in images: + # If we couldn't analyze the parent, we can't analyze this image. + if (image.parent and not image.parent.security_indexed and + image.parent.security_indexed_engine >= self._target_version): + set_secscan_status(image, False, self._target_version) + continue + # Analyze the image. analyzed = self._analyze_image(image) if not analyzed: