Various small fixes in prep for QE release
This commit is contained in:
parent
f55fd2049f
commit
73fa593d02
5 changed files with 11 additions and 10 deletions
|
@ -6,7 +6,7 @@ import time
|
|||
|
||||
from peewee import fn
|
||||
|
||||
from app import app, config_provider, secscan_api
|
||||
from app import app, secscan_api
|
||||
from workers.worker import Worker
|
||||
from data.database import Image, UseThenDisconnect
|
||||
from data.model.image import get_image_with_storage_and_parent_base
|
||||
|
@ -22,10 +22,9 @@ logger = logging.getLogger(__name__)
|
|||
class SecurityWorker(Worker):
|
||||
def __init__(self):
|
||||
super(SecurityWorker, self).__init__()
|
||||
validator = SecurityConfigValidator(app.config, config_provider)
|
||||
validator = SecurityConfigValidator(app.config)
|
||||
if validator.valid():
|
||||
secscan_config = app.config.get('SECURITY_SCANNER')
|
||||
self._target_version = secscan_config['ENGINE_VERSION_TARGET']
|
||||
self._target_version = app.config.get('SECURITY_SCANNER_ENGINE_VERSION_TARGET', 2)
|
||||
self._analyzer = LayerAnalyzer(app.config, secscan_api)
|
||||
|
||||
# Get the ID of the first image we want to analyze.
|
||||
|
@ -43,8 +42,11 @@ class SecurityWorker(Worker):
|
|||
base_query = get_image_with_storage_and_parent_base()
|
||||
return base_query.where(Image.security_indexed_engine < self._target_version)
|
||||
|
||||
# Get the ID of the last image we can analyze.
|
||||
# Get the ID of the last image we can analyze. Will be None if there are no images in the
|
||||
# database.
|
||||
max_id = Image.select(fn.Max(Image.id)).scalar()
|
||||
if max_id is None:
|
||||
return
|
||||
|
||||
with UseThenDisconnect(app.config):
|
||||
for candidate, abt in yield_random_entries(batch_query, Image.id, BATCH_SIZE, max_id,
|
||||
|
|
Reference in a new issue