summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker
diff options
context:
space:
mode:
authorRodolfo Carvalho <rhcarvalho@gmail.com>2017-05-12 11:23:21 +0200
committerLuke Meyer <lmeyer@redhat.com>2017-05-23 14:16:21 -0400
commitf880dba668ac8bd6de729540e6bf8d07b0ddc8be (patch)
tree0716e4c9e0d853f6e971d3e25a806316601ba1cd /roles/openshift_health_checker
parent68ff609d2948734303c5a845a53402cd8399e619 (diff)
downloadopenshift-f880dba668ac8bd6de729540e6bf8d07b0ddc8be.tar.gz
openshift-f880dba668ac8bd6de729540e6bf8d07b0ddc8be.tar.bz2
openshift-f880dba668ac8bd6de729540e6bf8d07b0ddc8be.tar.xz
openshift-f880dba668ac8bd6de729540e6bf8d07b0ddc8be.zip
Show help on how to disable checks after failure
Diffstat (limited to 'roles/openshift_health_checker')
-rw-r--r--roles/openshift_health_checker/callback_plugins/zz_failure_summary.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py b/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py
index 7bce7f107..1124c4125 100644
--- a/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py
+++ b/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py
@@ -59,6 +59,28 @@ class CallbackModule(CallbackBase):
indented = u'{}{}'.format(subsequent_indent, entry)
self._display.display(indented)
+ if self.__failures:
+ failed_checks = [
+ name
+ for name, result in failure['result']._result.get('checks', []).items()
+ for failure in self.__failures
+ if result.get('failed', False)
+ ]
+ # FIXME: get name of currently running playbook, if possible.
+ NAME_OF_PLAYBOOK = 'playbooks/byo/config.yml'
+ msg = (
+ "\nThe execution of the playbook '{}' includes checks designed "
+ 'to ensure it can complete successfully. One or more of these '
+ 'checks failed. You may choose to disable checks by setting an '
+ 'Ansible variable:\n\n'
+ ' openshift_disable_check={}\n\n'
+ 'Set the variable to a comma-separated list of check names. '
+ 'Check names are shown in the failure summary above.\n'
+ 'The variable can be set in the inventory or passed in the '
+ 'command line using the -e flag to ansible-playbook.'
+ ).format(NAME_OF_PLAYBOOK, ','.join(sorted(set(failed_checks))))
+ self._display.display(msg)
+
# Reason: disable pylint protected-access because we need to access _*
# attributes of a task result to implement this method.