From 2ecd2d983756024427224f61eb8abdb9f849c320 Mon Sep 17 00:00:00 2001 From: Reza Farrahi M Date: Thu, 21 Jun 2018 13:09:07 -0400 Subject: [PATCH 1/3] Added multiple paths in CHECKSD_OVERRIDE Added multiple paths in CHECKSD_OVERRIDE (issue #3758) --- config.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index f501fc5ef3..4853e5e004 100644 --- a/config.py +++ b/config.py @@ -218,8 +218,13 @@ def _confd_path(directory): def _checksd_path(directory): - path_override = os.environ.get('CHECKSD_OVERRIDE') - if path_override and os.path.exists(path_override): + checks_override_env = os.environ.get('CHECKSD_OVERRIDE') + checks_override_env_split = checks_override_env.split(':') + path_override=[] + for checks_override_env_individual_path in checks_override_env_split: + if checks_override_env_individual_path and os.path.exists(checks_override_env_individual_path): + path_override.append(checks_override_env_individual_path) + if path_override: return path_override # this is deprecated in testing on versions after SDK (5.12.0) @@ -1016,7 +1021,8 @@ def get_checks_places(osname, agentConfig): # agent-bundled integrations if checksd_path: - places.append(lambda name: (os.path.join(checksd_path, '%s.py' % name), None)) + for checksd_path_individual in checksd_path: + places.append(lambda name: (os.path.join(checksd_path_individual, '%s.py' % name), None)) return places From 00ef69115329690c11543106faecbe5d56961c09 Mon Sep 17 00:00:00 2001 From: Reza Farrahi Date: Mon, 26 Aug 2019 15:07:36 -0400 Subject: [PATCH 2/3] Fixed indentation --- config.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index 4853e5e004..603b94ada1 100644 --- a/config.py +++ b/config.py @@ -222,8 +222,8 @@ def _checksd_path(directory): checks_override_env_split = checks_override_env.split(':') path_override=[] for checks_override_env_individual_path in checks_override_env_split: - if checks_override_env_individual_path and os.path.exists(checks_override_env_individual_path): - path_override.append(checks_override_env_individual_path) + if checks_override_env_individual_path and os.path.exists(checks_override_env_individual_path): + path_override.append(checks_override_env_individual_path) if path_override: return path_override @@ -1021,8 +1021,8 @@ def get_checks_places(osname, agentConfig): # agent-bundled integrations if checksd_path: - for checksd_path_individual in checksd_path: - places.append(lambda name: (os.path.join(checksd_path_individual, '%s.py' % name), None)) + for checksd_path_individual in checksd_path: + places.append(lambda name: (os.path.join(checksd_path_individual, '%s.py' % name), None)) return places From 96cd5f1b0cfa2b9060149218bf1b4942efda22b6 Mon Sep 17 00:00:00 2001 From: Reza Farrahi Date: Mon, 26 Aug 2019 15:32:14 -0400 Subject: [PATCH 3/3] minor fix --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 603b94ada1..ed8fe2b374 100644 --- a/config.py +++ b/config.py @@ -220,7 +220,7 @@ def _confd_path(directory): def _checksd_path(directory): checks_override_env = os.environ.get('CHECKSD_OVERRIDE') checks_override_env_split = checks_override_env.split(':') - path_override=[] + path_override = [] for checks_override_env_individual_path in checks_override_env_split: if checks_override_env_individual_path and os.path.exists(checks_override_env_individual_path): path_override.append(checks_override_env_individual_path)