diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-05-23 14:16:12 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-05-23 14:56:20 -0400 |
commit | 323301a45b1adc20ea41b0633b53185a1a9d77e9 (patch) | |
tree | 10aa6ae0244963ec66b9192c4fc8cf5d79e88947 /roles/openshift_health_checker/action_plugins | |
parent | 1d5d13308bd79051b0bf3311240ef0e6cb286392 (diff) | |
download | openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.gz openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.bz2 openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.xz openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.zip |
health checks: specify check skip reason
Added indicator to check result for why that check was skipped.
Note that currently the user will only see it with ansible-playbook -vv
Diffstat (limited to 'roles/openshift_health_checker/action_plugins')
-rw-r--r-- | roles/openshift_health_checker/action_plugins/openshift_health_check.py | 17 |
1 files changed, 9 insertions, 8 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 a1df9cea3..a62e4331e 100644 --- a/roles/openshift_health_checker/action_plugins/openshift_health_check.py +++ b/roles/openshift_health_checker/action_plugins/openshift_health_check.py @@ -57,17 +57,18 @@ class ActionModule(ActionBase): display.banner("CHECK [{} : {}]".format(check_name, task_vars["ansible_host"])) check = known_checks[check_name] - if check_name not in user_disabled_checks and check.is_active(task_vars): + if not check.is_active(task_vars): + r = dict(skipped=True, skipped_reason="Not active for this host") + elif check_name in user_disabled_checks: + r = dict(skipped=True, skipped_reason="Disabled by user request") + else: try: r = check.run(tmp, task_vars) except OpenShiftCheckException as e: - r = {} - 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} + r = dict( + failed=True, + msg=str(e), + ) check_results[check_name] = r |