Only apply the unroll wrapper once (#72003)

Co-authored-by: Matt Martz <matt@sivel.net>

Fixes #71920
This commit is contained in:
Martin Krizek 2020-09-30 09:15:28 +02:00 committed by GitHub
parent 8893a244b9
commit 4197666179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix ``RecursionError`` when templating large vars structures (https://github.com/ansible/ansible/issues/71920)

View file

@ -257,6 +257,7 @@ def _unroll_iterator(func):
return list(ret)
return ret
wrapper.__UNROLLED__ = True
return _update_wrapper(wrapper, func)
@ -1086,7 +1087,8 @@ class Templar:
# Adds Ansible custom filters and tests
myenv.filters.update(self._get_filters())
for k in myenv.filters:
myenv.filters[k] = _unroll_iterator(myenv.filters[k])
if not getattr(myenv.filters[k], '__UNROLLED__', False):
myenv.filters[k] = _unroll_iterator(myenv.filters[k])
myenv.tests.update(self._get_tests())
if escape_backslashes: