From 692489cc50c8025ede1646627a7a583a4feb3798 Mon Sep 17 00:00:00 2001 From: yayogev Date: Thu, 31 Aug 2017 16:45:23 +0300 Subject: 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 --- app/discover/scanner.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'app/discover/scanner.py') 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) -- cgit 1.2.3-korg