aboutsummaryrefslogtreecommitdiff
path: root/ansible/action_plugins
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2025-09-10 07:44:04 +0200
committerMichal Nasiadka <mnasiadka@gmail.com>2025-10-28 11:26:36 +0000
commit3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa (patch)
tree1ded558649c141bb80019d49ea92a71743e6ec16 /ansible/action_plugins
parent011034a141b385ed4c86fd832425e800484efdb6 (diff)
downloadkolla-ansible-3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa.tar.gz
kolla-ansible-3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa.zip
Bump ansible-core to 2.18/2.19
Bumped collections in requirements-core.yml to Ansible 12 major versions, see [1]. [1]: https://github.com/ansible-community/ansible-build-data/blob/main/12/ansible-12.1.0.yaml Depends-On: https://review.opendev.org/c/openstack/kolla/+/960307 Co-authored-by: Doug Szumski doug@stackhpc.com Change-Id: If8a29052d8a43ffc0fef11514adabb5e4ab9d977 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'ansible/action_plugins')
-rw-r--r--ansible/action_plugins/merge_configs.py13
-rw-r--r--ansible/action_plugins/merge_yaml.py12
2 files changed, 23 insertions, 2 deletions
diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py
index a82583550..67a7da1cd 100644
--- a/ansible/action_plugins/merge_configs.py
+++ b/ansible/action_plugins/merge_configs.py
@@ -20,10 +20,21 @@ import tempfile
from ansible import constants
from ansible.plugins import action
+# TODO(dougszu): From Ansible 12 onwards we must explicitly trust templates.
+# Since this feature is not supported in previous releases, we define a
+# noop method here for backwards compatibility. This can be removed in the
+# G cycle.
+try:
+ from ansible.template import trust_as_template
+except ImportError:
+ def trust_as_template(template):
+ return template
+
from io import StringIO
from oslo_config import iniparser
+
_ORPHAN_SECTION = 'TEMPORARY_ORPHAN_VARIABLE_SECTION'
DOCUMENTATION = '''
@@ -150,7 +161,7 @@ class ActionModule(action.ActionBase):
# Only use config if present
if os.access(source, os.R_OK):
with open(source, 'r') as f:
- template_data = f.read()
+ template_data = trust_as_template(f.read())
# set search path to mimic 'template' module behavior
searchpath = [
diff --git a/ansible/action_plugins/merge_yaml.py b/ansible/action_plugins/merge_yaml.py
index ea7350bf7..d2c15eb70 100644
--- a/ansible/action_plugins/merge_yaml.py
+++ b/ansible/action_plugins/merge_yaml.py
@@ -23,6 +23,16 @@ from ansible import constants
from ansible import errors as ansible_errors
from ansible.plugins import action
+# TODO(dougszu): From Ansible 12 onwards we must explicitly trust templates.
+# Since this feature is not supported in previous releases, we define a
+# noop method here for backwards compatibility. This can be removed in the
+# G cycle.
+try:
+ from ansible.template import trust_as_template
+except ImportError:
+ def trust_as_template(template):
+ return template
+
DOCUMENTATION = '''
---
module: merge_yaml
@@ -91,7 +101,7 @@ class ActionModule(action.ActionBase):
# Only use config if present
if source and os.access(source, os.R_OK):
with open(source, 'r') as f:
- template_data = f.read()
+ template_data = trust_as_template(f.read())
# set search path to mimic 'template' module behavior
searchpath = [