From 6e4c344a6bcbad12edfb03d01517ab390634f35c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 20 Mar 2019 09:37:34 -0400 Subject: [PATCH] dict is dict (#54057) (cherry picked from commit d1a688b1d71d27b43e18be2af276509c879f1f0a) --- changelogs/fragments/dict_is_dict.yml | 2 ++ lib/ansible/template/__init__.py | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/dict_is_dict.yml diff --git a/changelogs/fragments/dict_is_dict.yml b/changelogs/fragments/dict_is_dict.yml new file mode 100644 index 00000000000..53076782ff3 --- /dev/null +++ b/changelogs/fragments/dict_is_dict.yml @@ -0,0 +1,2 @@ +bugfixes: + - allow 'dict()' jinja2 global to function the same even though it has changed in jinja2 versions diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index 066c2573e50..19fb5204516 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -726,6 +726,9 @@ class Templar: else: return data + # jinja2 global is inconsistent across versions, this normalizes them + t.globals['dict'] = dict + if disable_lookups: t.globals['query'] = t.globals['q'] = t.globals['lookup'] = self._fail_lookup else: