1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Flatten argument to with_items

Fixes #1711.
This commit is contained in:
Daniel Hokka Zakrisson 2013-02-17 22:07:47 +01:00
parent f02b9987fc
commit 43d22b0c42

View file

@ -15,6 +15,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
def flatten(terms):
ret = []
for term in terms:
if isinstance(term, list):
ret.extend(term)
else:
ret.append(term)
return ret
class LookupModule(object): class LookupModule(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -23,4 +32,4 @@ class LookupModule(object):
def run(self, terms, **kwargs): def run(self, terms, **kwargs):
if isinstance(terms, basestring): if isinstance(terms, basestring):
terms = [ terms ] terms = [ terms ]
return [term for term in terms] return flatten(terms)