Fix callback plugin for Ansible 2.5 compatability

Ansible 2.5 changed an internal callback method around that is
expected in plugins for options. In order for this to work, we needed
to make some minor changes.

Change-Id: I3801f339511155a4b8ecab91bb06b286b11c0a06
Related-Bug: #1758462
This commit is contained in:
Julia Kreger 2018-03-23 18:59:54 -07:00 committed by Dmitry Tantsur
parent 34277f6237
commit 83c4ec9393
2 changed files with 8 additions and 4 deletions

View File

@ -22,4 +22,4 @@ ImcSdk>=0.7.2
sushy
# Ansible-deploy interface
ansible>=2.4,<2.5.0
ansible>=2.4

View File

@ -85,13 +85,17 @@ class CallbackModule(object):
setup_log()
self.log = logging.getLogger(__name__)
self.node = None
self.opts = {}
self._plugin_options = {}
# NOTE(pas-ha) this method is required for Ansible>=2.4
# TODO(pas-ha) rewrite to support defining callback plugin options
# in ansible.cfg after we require Ansible >=2.4
def set_options(self, options):
self.opts = options
def set_options(self, option=None, option_value=None):
if option:
if option_value:
self._plugin_options[option] = option_value
else:
self._plugin_options = option
def runner_msg_dict(self, result):
self.node = result._host.get_name()