summaryrefslogtreecommitdiffstats
path: root/callback_plugins
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2016-08-05 08:26:37 -0600
committerRich Megginson <rmeggins@redhat.com>2016-08-08 11:55:52 -0600
commitf602a47aeaaae4dc99c96884ee6090f50d0542a4 (patch)
treeff5f93544146e14bda4250bec27bee5eb3aa21a8 /callback_plugins
parent91405ce840e19d56d7c6f653b07e640af23c34aa (diff)
downloadopenshift-f602a47aeaaae4dc99c96884ee6090f50d0542a4.tar.gz
openshift-f602a47aeaaae4dc99c96884ee6090f50d0542a4.tar.bz2
openshift-f602a47aeaaae4dc99c96884ee6090f50d0542a4.tar.xz
openshift-f602a47aeaaae4dc99c96884ee6090f50d0542a4.zip
make the improved log formatter work with ansible 2.1
Ansible 2.1 changed the base class used for log formatting. Using the old one with ansible 2.1 caused a "too much recursion" problem. The fix is to call _dump_results in the new CallbackBase base class when using ansible 2.1 or later.
Diffstat (limited to 'callback_plugins')
-rw-r--r--callback_plugins/default.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/callback_plugins/default.py b/callback_plugins/default.py
index 31e3d7d4c..bc0b207bb 100644
--- a/callback_plugins/default.py
+++ b/callback_plugins/default.py
@@ -27,6 +27,12 @@ DEFAULT_MODULE = imp.load_source(
DEFAULT_PATH
)
+try:
+ from ansible.plugins.callback import CallbackBase
+ BASECLASS = CallbackBase
+except ImportError: # < ansible 2.1
+ BASECLASS = DEFAULT_MODULE.CallbackModule
+
class CallbackModule(DEFAULT_MODULE.CallbackModule): # pylint: disable=too-few-public-methods,no-init
'''
@@ -48,7 +54,7 @@ class CallbackModule(DEFAULT_MODULE.CallbackModule): # pylint: disable=too-few-
if key in result:
save[key] = result.pop(key)
- output = DEFAULT_MODULE.CallbackModule._dump_results(self, result)
+ output = BASECLASS._dump_results(self, result) # pylint: disable=protected-access
for key in ['stdout', 'stderr', 'msg']:
if key in save and save[key]: