From 57674fa04706d12ea909817a643c18d27df0f559 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 19 Feb 2015 16:04:57 -0500 Subject: [PATCH] Allow requesting a list to lookup plugins instead of , delimited string --- lib/ansible/utils/template.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 9556b8fcea8..722e33e4c8f 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -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: