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

pull/2263/head
Michael DeHaan 12 years ago
parent 129e0b8baf
commit 7ac5e462ef

@ -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

Loading…
Cancel
Save