summaryrefslogtreecommitdiff
path: root/lib/ansible
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2023-01-23 16:42:38 +0100
committerGitHub <noreply@github.com>2023-01-23 09:42:38 -0600
commit83db3015e9ac7515d4a0f3a8827b46656b50990c (patch)
tree6bac3b7bea22cc8a6eb3ac8a3ca969ba77fda57f /lib/ansible
parenta7aeb61c030b1d396c3ecd97657de2c584ee5354 (diff)
downloadansible-83db3015e9ac7515d4a0f3a8827b46656b50990c.tar.gz
Fix traceback in template action with ANSIBLE_DEBUG=1 (#79764) (#79775)
Fixes #79763 (cherry picked from commit 4f5ed249727dc0c271e07b045e514cc31e25c2de)
Diffstat (limited to 'lib/ansible')
-rw-r--r--lib/ansible/plugins/action/template.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/plugins/action/template.py b/lib/ansible/plugins/action/template.py
index 2e3d3641bf..d2b3df9ab7 100644
--- a/lib/ansible/plugins/action/template.py
+++ b/lib/ansible/plugins/action/template.py
@@ -118,7 +118,11 @@ class ActionModule(ActionBase):
searchpath = newsearchpath
# add ansible 'template' vars
- temp_vars = task_vars | generate_ansible_template_vars(self._task.args.get('src', None), source, dest)
+ temp_vars = task_vars.copy()
+ # NOTE in the case of ANSIBLE_DEBUG=1 task_vars is VarsWithSources(MutableMapping)
+ # so | operator cannot be used as it can be used only on dicts
+ # https://peps.python.org/pep-0584/#what-about-mapping-and-mutablemapping
+ temp_vars.update(generate_ansible_template_vars(self._task.args.get('src', None), source, dest))
# force templar to use AnsibleEnvironment to prevent issues with native types
# https://github.com/ansible/ansible/issues/46169