Skip to content
Snippets Groups Projects
Verified Commit 56a1a00e authored by Unit 193's avatar Unit 193
Browse files

d/p/ansible-12-data-tagging: Add patch to fix more compatibility problems.

Closes: #1103652
parent 46b3105b
No related branches found
No related tags found
No related merge requests found
Pipeline #862692 passed
From: Claude Becker <becker@phys.ethz.ch>
Date: Thu, 24 Apr 2025 09:09:20 +0200
Subject: Ugly patch for ansible 12 data tagging
---
ansible_mitogen/mixins.py | 23 ++++++++++++++---------
ansible_mitogen/runner.py | 3 +++
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py
index c79bf10..4039078 100644
--- a/ansible_mitogen/mixins.py
+++ b/ansible_mitogen/mixins.py
@@ -402,15 +402,16 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
if not self._mitogen_rediscovered_interpreter:
result['ansible_facts'][self._discovered_interpreter_key] = self._discovered_interpreter
- if self._discovery_warnings:
- if result.get('warnings') is None:
- result['warnings'] = []
- result['warnings'].extend(self._discovery_warnings)
+ if ansible_mitogen.utils.ansible_version[:2] < (2, 19):
+ if self._discovery_warnings:
+ if result.get('warnings') is None:
+ result['warnings'] = []
+ result['warnings'].extend(self._discovery_warnings)
- if self._discovery_deprecation_warnings:
- if result.get('deprecations') is None:
- result['deprecations'] = []
- result['deprecations'].extend(self._discovery_deprecation_warnings)
+ if self._discovery_deprecation_warnings:
+ if result.get('deprecations') is None:
+ result['deprecations'] = []
+ result['deprecations'].extend(self._discovery_deprecation_warnings)
return ansible.utils.unsafe_proxy.wrap_var(result)
@@ -429,7 +430,11 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
"stderr": "stderr data"
}
"""
- data = self._parse_returned_data(result)
+ if ansible_mitogen.utils.ansible_version[:2] >= (2, 19):
+ # Pass legacy serialization profile to Ansible 2.19+
+ data = self._parse_returned_data(result, 'legacy')
+ else:
+ data = self._parse_returned_data(result)
# Cutpasted from the base implementation.
if 'stdout' in data and 'stdout_lines' not in data:
diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py
index b60e537..be54afa 100644
--- a/ansible_mitogen/runner.py
+++ b/ansible_mitogen/runner.py
@@ -76,6 +76,9 @@ except ImportError:
import ansible.module_utils.basic
ansible.module_utils.basic._ANSIBLE_ARGS = '{}'
+# Ugly patch for ansible data tagging https://github.com/ansible/ansible/pull/84621
+ansible.module_utils.basic._ANSIBLE_PROFILE = 'legacy'
+
# For tasks that modify /etc/resolv.conf, non-Debian derivative glibcs cache
# resolv.conf at startup and never implicitly reload it. Cope with that via an
# explicit call to res_init() on each task invocation. BSD-alikes export it
......@@ -6,3 +6,4 @@ skip-python2.7-test
edit-ansible-version-restrictions
workaround-missing-strip-unsafe
replace-jsonify
ansible-12-data-tagging
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment