Use templar all the way down

Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
This commit is contained in:
James Cammarata 2015-08-04 12:10:23 -04:00
parent c3ce140dd2
commit 5266679964
15 changed files with 44 additions and 42 deletions

View file

@ -22,7 +22,6 @@ from re import compile as re_compile, IGNORECASE
from ansible.errors import *
from ansible.parsing.splitter import parse_kv
from ansible.plugins.lookup import LookupBase
from ansible.template import Templar
# shortcut format
NUM = "(0?x?[0-9a-f]+)"
@ -188,13 +187,11 @@ class LookupModule(LookupBase):
if isinstance(terms, basestring):
terms = [ terms ]
templar = Templar(loader=self._loader, variables=variables)
for term in terms:
try:
self.reset() # clear out things for this iteration
term = templar.template(term)
term = self._templar.template(term)
try:
if not self.parse_simple_args(term):
self.parse_kv_args(parse_kv(term))