mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Make all lookup plugins work with lists
Lookup plugins should accept a string or a list, and always return a list, even if it is just one item.
This commit is contained in:
@@ -23,5 +23,9 @@ class LookupModule(object):
|
||||
self.basedir = basedir
|
||||
|
||||
def run(self, terms, inject=None, **kwargs):
|
||||
return utils.template_from_file(self.basedir, terms, inject)
|
||||
|
||||
if isinstance(terms, basestring):
|
||||
terms = [ terms ]
|
||||
ret = []
|
||||
for term in terms:
|
||||
ret.append(utils.template_from_file(self.basedir, term, inject))
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user