From d1a688b1d71d27b43e18be2af276509c879f1f0a 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) --- 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 9739e1cbc3c..86ca17968fb 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -690,6 +690,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: