From 22efd5de5478676fc643a534ab52360f20eb968a Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 23 Mar 2018 18:59:54 -0700 Subject: [PATCH] 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 (cherry picked from commit 3631fd4791dd13977e446ee8445dbd1225d890bc) --- driver-requirements.txt | 2 +- .../ansible/playbooks/callback_plugins/ironic_log.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/driver-requirements.txt b/driver-requirements.txt index e825b32d81..6435463334 100644 --- a/driver-requirements.txt +++ b/driver-requirements.txt @@ -22,4 +22,4 @@ ImcSdk>=0.7.2 sushy # Ansible-deploy interface -ansible>=2.4,<2.5.0 +ansible>=2.4 diff --git a/ironic/drivers/modules/ansible/playbooks/callback_plugins/ironic_log.py b/ironic/drivers/modules/ansible/playbooks/callback_plugins/ironic_log.py index 55fa5b8344..e3fb9d3ef1 100644 --- a/ironic/drivers/modules/ansible/playbooks/callback_plugins/ironic_log.py +++ b/ironic/drivers/modules/ansible/playbooks/callback_plugins/ironic_log.py @@ -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()