Merge pull request #2390 from jakedt/disableworker

Make the security scanning worker period configurable
This commit is contained in:
Jake Moshenko 2017-02-27 15:17:25 -05:00 committed by GitHub
commit 825234c919
2 changed files with 6 additions and 2 deletions

View file

@ -310,6 +310,9 @@ class DefaultConfig(object):
# The endpoint for the security scanner.
SECURITY_SCANNER_ENDPOINT = 'http://192.168.99.101:6060'
# The number of seconds between indexing intervals in the security scanner
SECURITY_SCANNER_INDEXING_INTERVAL = 30
# If specified, the endpoint to be used for all POST calls to the security scanner.
SECURITY_SCANNER_ENDPOINT_BATCH = None

View file

@ -15,7 +15,7 @@ from endpoints.v2 import v2_bp
BATCH_SIZE = 50
INDEXING_INTERVAL = 30
DEFAULT_INDEXING_INTERVAL = 30
logger = logging.getLogger(__name__)
@ -35,7 +35,8 @@ class SecurityWorker(Worker):
# Get the ID of the first image we want to analyze.
self._min_id = get_min_id_for_sec_scan(self._target_version)
self.add_operation(self._index_images, INDEXING_INTERVAL)
interval = app.config.get('SECURITY_SCANNER_INDEXING_INTERVAL', DEFAULT_INDEXING_INTERVAL)
self.add_operation(self._index_images, interval)
else:
logger.warning('Failed to validate security scan configuration')