mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +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:
@@ -24,6 +24,10 @@ class LookupModule(object):
|
||||
self.basedir = basedir
|
||||
|
||||
def run(self, terms, **kwargs):
|
||||
|
||||
var = terms.split()[0]
|
||||
return os.getenv(var, '')
|
||||
if isinstance(terms, basestring):
|
||||
terms = [ terms ]
|
||||
ret = []
|
||||
for term in terms:
|
||||
var = term.split()[0]
|
||||
ret.append(os.getenv(var, ''))
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user