From 78b0f48b178325c74d5609bac5c764ac111ad808 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Tue, 24 Oct 2017 13:35:42 +0300 Subject: several bug fixes for release 1.1 Change-Id: I433d41245107a68959efdcd6b56ce3348c7bbeb5 Signed-off-by: Koren Lev (cherry picked from commit 7cba26258ea17f790028a7005cb9bbbdc3923389) --- app/discover/scan.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'app/discover/scan.py') diff --git a/app/discover/scan.py b/app/discover/scan.py index 6c40a7f..49f37ff 100755 --- a/app/discover/scan.py +++ b/app/discover/scan.py @@ -319,13 +319,20 @@ class ScanController(Fetcher): SshConnection.disconnect_all() status = 'ok' if not scanner.found_errors.get(env_name, False) \ else 'errors detected' + if status == 'ok' and scan_plan.object_type == "environment": + self.mark_env_scanned(scan_plan.env) self.log.info('Scan completed, status: {}'.format(status)) return True, status + def mark_env_scanned(self, env): + environments_collection = self.inv.collection['environments_config'] + environments_collection \ + .update_one(filter={'name': env}, + update={'$set': {'scanned': True}}) if __name__ == '__main__': - scan_manager = ScanController() - ret, msg = scan_manager.run() + scan_controller = ScanController() + ret, msg = scan_controller.run() if not ret: - scan_manager.log.error(msg) + scan_controller.log.error(msg) sys.exit(0 if ret else 1) -- cgit 1.2.3-korg