aboutsummaryrefslogtreecommitdiffstats
path: root/app/discover/scanner.py
diff options
context:
space:
mode:
authoryayogev <yaronyogev@gmail.com>2017-08-31 16:45:23 +0300
committeryayogev <yaronyogev@gmail.com>2017-08-31 16:45:23 +0300
commit692489cc50c8025ede1646627a7a583a4feb3798 (patch)
tree531a2f2928ba8c9067265fa0c872cc6f016876b8 /app/discover/scanner.py
parentbc3767bad9f9f9cfb3f3f2c8871a81603e650df0 (diff)
US2876 handle SSH errors
ido not stop, but report as 'completed with errors' if there were any errors in SSH calls Change-Id: Ice7e6c4324686adc2d9eec27a9b6187f0fe6808f Signed-off-by: yayogev <yaronyogev@gmail.com>
Diffstat (limited to 'app/discover/scanner.py')
-rw-r--r--app/discover/scanner.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/discover/scanner.py b/app/discover/scanner.py
index 1b7cd51..c310ae7 100644
--- a/app/discover/scanner.py
+++ b/app/discover/scanner.py
@@ -25,9 +25,8 @@ from discover.find_links_for_vedges import FindLinksForVedges
from discover.find_links_for_vservice_vnics import FindLinksForVserviceVnics
from discover.scan_error import ScanError
from discover.scan_metadata_parser import ScanMetadataParser
-from utils.constants import EnvironmentFeatures
from utils.inventory_mgr import InventoryMgr
-from utils.util import ClassResolver
+from utils.ssh_connection import SshError
class Scanner(Fetcher):
@@ -38,6 +37,9 @@ class Scanner(Fetcher):
scan_queue = queue.Queue()
scan_queue_track = {}
+ # keep errors indication per environment
+ found_errors = {}
+
def __init__(self):
"""
Scanner is the base class for scanners.
@@ -71,6 +73,9 @@ class Scanner(Fetcher):
"children": children})
except ValueError:
return False
+ except SshError:
+ # mark the error
+ self.found_errors[self.get_env()] = True
if limit_to_child_id and len(types_children) > 0:
t = types_children[0]
children = t["children"]
@@ -135,6 +140,9 @@ class Scanner(Fetcher):
# It depends on the Fetcher's config.
try:
db_results = fetcher.get(escaped_id)
+ except SshError:
+ self.found_errors[self.get_env()] = True
+ return []
except Exception as e:
self.log.error("Error while scanning : " +
"fetcher=%s, " +
@@ -233,7 +241,9 @@ class Scanner(Fetcher):
clique_scanner.find_cliques()
def deploy_monitoring_setup(self):
- self.inv.monitoring_setup_manager.handle_pending_setup_changes()
+ ret = self.inv.monitoring_setup_manager.handle_pending_setup_changes()
+ if not ret:
+ self.found_errors[self.get_env()] = True
def load_metadata(self):
parser = ScanMetadataParser(self.inv)