Commit 7ac5e462 by Michael DeHaan

Fixed a small buglet, if using with_items with yum and so on, only optimize the…

Fixed a small buglet, if using with_items with yum and so on, only optimize the package list if the package list is all strings
parent 129e0b8b
......@@ -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
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment