1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix for bug in Conditional for older jinja2 versions

Fixes #20309
This commit is contained in:
James Cammarata 2017-01-16 13:04:55 -06:00
parent 3ee3e3b5a8
commit af96cba7e1

View file

@ -22,6 +22,7 @@ __metaclass__ = type
import ast
import re
from jinja2.compiler import generate
from jinja2.exceptions import UndefinedError
from ansible.compat.six import text_type
@ -152,7 +153,7 @@ class Conditional:
presented = "{%% if %s %%} True {%% else %%} False {%% endif %%}" % conditional
res = e._parse(presented, None, None)
res = e._generate(res, None, None, defer_init=True)
res = generate(res, e, None, None)
parsed = ast.parse(res, mode='exec')
class CleansingNodeVisitor(ast.NodeVisitor):