mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow variables to be used raw in with_nested
This commit is contained in:
parent
fbea88b9d9
commit
5cced79cf3
1 changed files with 10 additions and 0 deletions
|
@ -42,11 +42,21 @@ class LookupModule(object):
|
|||
def __init__(self, basedir=None, **kwargs):
|
||||
self.basedir = basedir
|
||||
|
||||
def __lookup_injects(self, terms, inject):
|
||||
results = []
|
||||
for x in terms:
|
||||
if isinstance(x, basestring) and x in inject:
|
||||
results.append(inject[x])
|
||||
else:
|
||||
results.append(x)
|
||||
return results
|
||||
|
||||
def run(self, terms, inject=None, **kwargs):
|
||||
|
||||
# this code is common with 'items.py' consider moving to utils if we need it again
|
||||
|
||||
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
|
||||
terms = self.__lookup_injects(terms, inject)
|
||||
|
||||
my_list = terms[:]
|
||||
my_list.reverse()
|
||||
|
|
Loading…
Reference in a new issue