summaryrefslogtreecommitdiffstats
path: root/roles/lib_utils
diff options
context:
space:
mode:
authorMichael Gugino <gugino.michael@yahoo.com>2018-02-12 22:03:37 -0500
committerGitHub <noreply@github.com>2018-02-12 22:03:37 -0500
commitcf6d85fca0d42466f42b64cf205e83e7f1586369 (patch)
tree7df8f11d1f3b4d8380817e162cf77e91d44dde3a /roles/lib_utils
parent10760235ed1deeed03e9451ec72dfbea63841177 (diff)
parenta043ba9e9951d091f66d00ed88ad05b66c3f3c63 (diff)
downloadopenshift-cf6d85fca0d42466f42b64cf205e83e7f1586369.tar.gz
openshift-cf6d85fca0d42466f42b64cf205e83e7f1586369.tar.bz2
openshift-cf6d85fca0d42466f42b64cf205e83e7f1586369.tar.xz
openshift-cf6d85fca0d42466f42b64cf205e83e7f1586369.zip
Merge pull request #7113 from mgugino-upstream-stage/fix-etcd-scaleup-sanity
Fix etcd scaleup plays
Diffstat (limited to 'roles/lib_utils')
-rw-r--r--roles/lib_utils/action_plugins/sanity_checks.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/roles/lib_utils/action_plugins/sanity_checks.py b/roles/lib_utils/action_plugins/sanity_checks.py
index 09ce55e8f..ce54debc2 100644
--- a/roles/lib_utils/action_plugins/sanity_checks.py
+++ b/roles/lib_utils/action_plugins/sanity_checks.py
@@ -54,6 +54,12 @@ class ActionModule(ActionBase):
def template_var(self, hostvars, host, varname):
"""Retrieve a variable from hostvars and template it.
If undefined, return None type."""
+ # We will set the current host and variable checked for easy debugging
+ # if there are any unhandled exceptions.
+ # pylint: disable=W0201
+ self.last_checked_var = varname
+ # pylint: disable=W0201
+ self.last_checked_host = host
res = hostvars[host].get(varname)
if res is None:
return None
@@ -156,6 +162,11 @@ class ActionModule(ActionBase):
# pylint: disable=W0201
self.task_vars = task_vars or {}
+ # pylint: disable=W0201
+ self.last_checked_host = "none"
+ # pylint: disable=W0201
+ self.last_checked_var = "none"
+
# self._task.args holds task parameters.
# check_hosts is a parameter to this plugin, and should provide
# a list of hosts.
@@ -172,7 +183,13 @@ class ActionModule(ActionBase):
# We loop through each host in the provided list check_hosts
for host in check_hosts:
- self.run_checks(hostvars, host)
+ try:
+ self.run_checks(hostvars, host)
+ except Exception as uncaught_e:
+ msg = "last_checked_host: {}, last_checked_var: {};"
+ msg = msg.format(self.last_checked_host, self.last_checked_var)
+ msg += str(uncaught_e)
+ raise errors.AnsibleModuleError(msg)
result["changed"] = False
result["failed"] = False