diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index c2dc875caf..f06012137e 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -343,7 +343,7 @@ class Runner(object): if type(items) != list: raise errors.AnsibleError("lookup plugins have to return a list: %r" % items) - if len(items) and self.module_name in [ 'apt', 'yum' ]: + if len(items) and utils.is_list_of_strings(items) and self.module_name in [ 'apt', 'yum' ]: # hack for apt and soon yum, with_items maps back into a single module call inject['item'] = ",".join(items) items = None diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 466fbb3f95..40d42ba146 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -654,4 +654,9 @@ def get_diff(diff): except UnicodeDecodeError: return ">> the files are different, but the diff library cannot compare unicode strings" - +def is_list_of_strings(items): + for x in items: + if not isinstance(x, basestring): + return False + return True +