From f666cfba54d300366822de2046766776c3e7771f Mon Sep 17 00:00:00 2001 From: yayogev Date: Wed, 6 Sep 2017 20:06:19 +0300 Subject: allow debug with different app path for Sensu handler Change-Id: I097973a35bc2297d612f93a43d0285b8223b7091 Signed-off-by: yayogev --- app/discover/scanner.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app/discover') diff --git a/app/discover/scanner.py b/app/discover/scanner.py index 3a0b2a5..d1323bd 100644 --- a/app/discover/scanner.py +++ b/app/discover/scanner.py @@ -235,10 +235,16 @@ class Scanner(Fetcher): if not ret: self.found_errors[self.get_env()] = True + def get_run_app_path(self): + conf = self.config.get_env_config() + run_app_path = conf.get('run_app_path', '') + if not run_app_path: + run_app_path = conf.get('app_path', '/etc/calipso') + return run_app_path + def load_scanners_metadata(self): parser = ScanMetadataParser(self.inv) - conf = self.config.get_env_config() - scanners_file = os.path.join(conf.get('app_path', '/etc/calipso'), + scanners_file = os.path.join(self.get_run_app_path(), 'config', ScanMetadataParser.SCANNERS_FILE) @@ -249,7 +255,7 @@ class Scanner(Fetcher): def load_link_finders_metadata(self): parser = FindLinksMetadataParser() conf = self.config.get_env_config() - finders_file = os.path.join(conf.get('app_path', '/etc/calipso'), + finders_file = os.path.join(self.get_run_app_path(), 'config', FindLinksMetadataParser.FINDERS_FILE) metadata = parser.parse_metadata_file(finders_file) -- cgit 1.2.3-korg