mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 05:49:09 -07:00
listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when specified like this: with_lookup: terms
This commit is contained in:
parent
e32d887609
commit
d35b956900
23 changed files with 16 additions and 50 deletions
|
@ -29,7 +29,13 @@ class LookupModule(LookupBase):
|
|||
[1, 2, 3], [a, b] -> [1, a], [1, b], [2, a], [2, b], [3, a], [3, b]
|
||||
"""
|
||||
|
||||
def __lookup_variables(self, terms):
|
||||
def _lookup_variables(self, terms):
|
||||
"""
|
||||
Turn this:
|
||||
terms == ["1,2,3", "a,b"]
|
||||
into this:
|
||||
terms == [[1,2,3], [a, b]]
|
||||
"""
|
||||
results = []
|
||||
for x in terms:
|
||||
intermediate = listify_lookup_plugin_terms(x, templar=self._templar, loader=self._loader)
|
||||
|
@ -38,7 +44,7 @@ class LookupModule(LookupBase):
|
|||
|
||||
def run(self, terms, variables=None, **kwargs):
|
||||
|
||||
terms = self.__lookup_variables(terms)
|
||||
terms = self._lookup_variables(terms)
|
||||
|
||||
my_list = terms[:]
|
||||
if len(my_list) == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue