|
|
@ -604,6 +604,11 @@ class Templar:
|
|
|
|
def _fail_lookup(self, name, *args, **kwargs):
|
|
|
|
def _fail_lookup(self, name, *args, **kwargs):
|
|
|
|
raise AnsibleError("The lookup `%s` was found, however lookups were disabled from templating" % name)
|
|
|
|
raise AnsibleError("The lookup `%s` was found, however lookups were disabled from templating" % name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _query_lookup(self, name, *args, **kwargs):
|
|
|
|
|
|
|
|
''' wrapper for lookup, force wantlist true'''
|
|
|
|
|
|
|
|
kwargs['wantlist'] = True
|
|
|
|
|
|
|
|
return self._lookup(name, *args, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def _lookup(self, name, *args, **kwargs):
|
|
|
|
def _lookup(self, name, *args, **kwargs):
|
|
|
|
instance = self._lookup_loader.get(name.lower(), loader=self._loader, templar=self)
|
|
|
|
instance = self._lookup_loader.get(name.lower(), loader=self._loader, templar=self)
|
|
|
|
|
|
|
|
|
|
|
@ -694,9 +699,10 @@ class Templar:
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
if disable_lookups:
|
|
|
|
if disable_lookups:
|
|
|
|
t.globals['lookup'] = self._fail_lookup
|
|
|
|
t.globals['query'] = t.globals['q'] = t.globals['lookup'] = self._fail_lookup
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
t.globals['lookup'] = self._lookup
|
|
|
|
t.globals['lookup'] = self._lookup
|
|
|
|
|
|
|
|
t.globals['query'] = t.globals['q'] = self._query_lookup
|
|
|
|
|
|
|
|
|
|
|
|
t.globals['finalize'] = self._finalize
|
|
|
|
t.globals['finalize'] = self._finalize
|
|
|
|
|
|
|
|
|
|
|
|