Merge pull request #915 from coreos-inc/clair-worker-update-children

securityworker: mark children we can't analyze
This commit is contained in:
Silas Sewell 2015-11-19 12:11:11 -05:00
commit 90ec66561d
2 changed files with 6 additions and 1 deletions

View file

@ -492,7 +492,6 @@ def get_secscan_candidates(engine_version, batch_size):
.switch(Image) .switch(Image)
.join(ImageStorage) .join(ImageStorage)
.where(Image.security_indexed_engine < engine_version, .where(Image.security_indexed_engine < engine_version,
Parent.security_indexed == True,
Parent.security_indexed_engine >= engine_version, Parent.security_indexed_engine >= engine_version,
ImageStorage.uploading == False) ImageStorage.uploading == False)
.limit(batch_size*10)) .limit(batch_size*10))

View file

@ -163,6 +163,12 @@ class SecurityWorker(Worker):
logger.debug('Found %d images to index', len(images)) logger.debug('Found %d images to index', len(images))
for image in 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. # Analyze the image.
analyzed = self._analyze_image(image) analyzed = self._analyze_image(image)
if not analyzed: if not analyzed: