mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow requesting a list to lookup plugins instead of , delimited string
This commit is contained in:
parent
ee08448b2e
commit
57674fa047
1 changed files with 3 additions and 1 deletions
|
@ -89,6 +89,8 @@ def lookup(name, *args, **kwargs):
|
|||
instance = utils.plugins.lookup_loader.get(name.lower(), basedir=kwargs.get('basedir',None))
|
||||
tvars = kwargs.get('vars', None)
|
||||
|
||||
wantlist = kwargs.pop('wantlist', False)
|
||||
|
||||
if instance is not None:
|
||||
try:
|
||||
ran = instance.run(*args, inject=tvars, **kwargs)
|
||||
|
@ -98,7 +100,7 @@ def lookup(name, *args, **kwargs):
|
|||
raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e))
|
||||
except Exception, e:
|
||||
raise errors.AnsibleError('Unexpected error in during lookup: %s' % e)
|
||||
if ran:
|
||||
if ran and not wantlist:
|
||||
ran = ",".join(ran)
|
||||
return ran
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue