From 43d22b0c421e72772be092c3f1ebeaa0f9613dff Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Sun, 17 Feb 2013 22:07:47 +0100 Subject: [PATCH] Flatten argument to with_items Fixes #1711. --- lib/ansible/runner/lookup_plugins/items.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/lookup_plugins/items.py b/lib/ansible/runner/lookup_plugins/items.py index f11c1fab1d..dba0afb7fd 100644 --- a/lib/ansible/runner/lookup_plugins/items.py +++ b/lib/ansible/runner/lookup_plugins/items.py @@ -15,6 +15,15 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +def flatten(terms): + ret = [] + for term in terms: + if isinstance(term, list): + ret.extend(term) + else: + ret.append(term) + return ret + class LookupModule(object): def __init__(self, **kwargs): @@ -23,4 +32,4 @@ class LookupModule(object): def run(self, terms, **kwargs): if isinstance(terms, basestring): terms = [ terms ] - return [term for term in terms] + return flatten(terms)