summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Carvalho <rhcarvalho@gmail.com>2017-05-11 15:26:01 +0200
committerLuke Meyer <lmeyer@redhat.com>2017-05-23 14:16:21 -0400
commit68ff609d2948734303c5a845a53402cd8399e619 (patch)
treeaaabdc059a7ca6d27cb16ae8a8d45b10b6dca25a
parentc8ec88b661133e05095d5b8310d15af36bb35f34 (diff)
downloadopenshift-68ff609d2948734303c5a845a53402cd8399e619.tar.gz
openshift-68ff609d2948734303c5a845a53402cd8399e619.tar.bz2
openshift-68ff609d2948734303c5a845a53402cd8399e619.tar.xz
openshift-68ff609d2948734303c5a845a53402cd8399e619.zip
Allow disabling checks via Ansible variable
Example usage: $ ansible-playbook -i hosts playbooks/byo/config.yml -e openshift_disable_check=memory_availability,disk_availability Or add the variable to the inventory / hosts file.
-rw-r--r--roles/openshift_health_checker/action_plugins/openshift_health_check.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/roles/openshift_health_checker/action_plugins/openshift_health_check.py b/roles/openshift_health_checker/action_plugins/openshift_health_check.py
index 03c40b78b..e8a4c6474 100644
--- a/roles/openshift_health_checker/action_plugins/openshift_health_check.py
+++ b/roles/openshift_health_checker/action_plugins/openshift_health_check.py
@@ -46,11 +46,16 @@ class ActionModule(ActionBase):
result["checks"] = check_results = {}
+ user_disabled_checks = [
+ check.strip()
+ for check in task_vars.get("openshift_disable_check", "").split(",")
+ ]
+
for check_name in resolved_checks:
display.banner("CHECK [{} : {}]".format(check_name, task_vars["ansible_host"]))
check = known_checks[check_name]
- if check.is_active(task_vars):
+ if check_name not in user_disabled_checks and check.is_active(task_vars):
try:
r = check.run(tmp, task_vars)
except OpenShiftCheckException as e:
@@ -58,6 +63,8 @@ class ActionModule(ActionBase):
r["failed"] = True
r["msg"] = str(e)
else:
+ # TODO(rhcarvalho): we may want to provide some distinctive
+ # complementary message to know why a check was skipped.
r = {"skipped": True}
check_results[check_name] = r