|
|
@ -592,10 +592,15 @@ class AnsibleEnvironment(NativeEnvironment):
|
|
|
|
if not C.JINJA2_BYTECODE_CACHE:
|
|
|
|
if not C.JINJA2_BYTECODE_CACHE:
|
|
|
|
return super().compile(source, name=name, filename=filename, raw=raw, defer_init=defer_init) # type: ignore[call-overload]
|
|
|
|
return super().compile(source, name=name, filename=filename, raw=raw, defer_init=defer_init) # type: ignore[call-overload]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Environment._parse
|
|
|
|
parsed = Parser(self, source, name, filename).parse()
|
|
|
|
parsed = Parser(self, source, name, filename).parse()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This wrapper ensures that all templates are not considered literal/constant
|
|
|
|
eval_ctx = nodes.ScopedEvalContextModifier(lineno=-1)
|
|
|
|
eval_ctx = nodes.ScopedEvalContextModifier(lineno=-1)
|
|
|
|
eval_ctx.options = [nodes.Keyword('volatile', nodes.Const(True))]
|
|
|
|
eval_ctx.options = [nodes.Keyword('volatile', nodes.Const(True))]
|
|
|
|
eval_ctx.body = parsed.body
|
|
|
|
eval_ctx.body = parsed.body
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Environment._generate
|
|
|
|
generated = generate(
|
|
|
|
generated = generate(
|
|
|
|
nodes.Template([eval_ctx], lineno=-1),
|
|
|
|
nodes.Template([eval_ctx], lineno=-1),
|
|
|
|
self,
|
|
|
|
self,
|
|
|
@ -604,6 +609,7 @@ class AnsibleEnvironment(NativeEnvironment):
|
|
|
|
defer_init=False,
|
|
|
|
defer_init=False,
|
|
|
|
optimized=self.optimized,
|
|
|
|
optimized=self.optimized,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
return compile(generated, filename or '<template>', 'exec')
|
|
|
|
return compile(generated, filename or '<template>', 'exec')
|
|
|
|
|
|
|
|
|
|
|
|
def from_string(
|
|
|
|
def from_string(
|
|
|
|