diff options
author | OpenShift Bot <eparis+openshiftbot@redhat.com> | 2017-06-06 11:09:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 11:09:13 -0400 |
commit | 07aa3e0fb2e8eb822ad67c2e24e81a8e028280ff (patch) | |
tree | 75dafc899e6a4f3406aa768dc0d6efa92621dd31 /roles/openshift_health_checker/openshift_checks/__init__.py | |
parent | 2d4709b5a65c5bb2777277420ee08f8554efb1ab (diff) | |
parent | 2e53dbb4c0d9bfe79cd79e0a0ece9db065b286df (diff) | |
download | openshift-07aa3e0fb2e8eb822ad67c2e24e81a8e028280ff.tar.gz openshift-07aa3e0fb2e8eb822ad67c2e24e81a8e028280ff.tar.bz2 openshift-07aa3e0fb2e8eb822ad67c2e24e81a8e028280ff.tar.xz openshift-07aa3e0fb2e8eb822ad67c2e24e81a8e028280ff.zip |
Merge pull request #3643 from juanvallejo/jvallejo/elastic-search-check
Merged by openshift-bot
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/__init__.py')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/__init__.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/__init__.py b/roles/openshift_health_checker/openshift_checks/__init__.py index be63d864a..5c9949ced 100644 --- a/roles/openshift_health_checker/openshift_checks/__init__.py +++ b/roles/openshift_health_checker/openshift_checks/__init__.py @@ -66,16 +66,26 @@ class OpenShiftCheck(object): LOADER_EXCLUDES = ( "__init__.py", "mixins.py", + "logging.py", ) -def load_checks(): +def load_checks(path=None, subpkg=""): """Dynamically import all check modules for the side effect of registering checks.""" - return [ - import_module(__package__ + "." + name[:-3]) - for name in os.listdir(os.path.dirname(__file__)) - if name.endswith(".py") and name not in LOADER_EXCLUDES - ] + if path is None: + path = os.path.dirname(__file__) + + modules = [] + + for name in os.listdir(path): + if os.path.isdir(os.path.join(path, name)): + modules = modules + load_checks(os.path.join(path, name), subpkg + "." + name) + continue + + if name.endswith(".py") and name not in LOADER_EXCLUDES: + modules.append(import_module(__package__ + subpkg + "." + name[:-3])) + + return modules def get_var(task_vars, *keys, **kwargs): |