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

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

This commit is contained in:
Michael DeHaan 2013-03-01 18:32:32 -05:00
parent 129e0b8baf
commit 7ac5e462ef
2 changed files with 7 additions and 2 deletions

View file

@ -343,7 +343,7 @@ class Runner(object):
if type(items) != list: if type(items) != list:
raise errors.AnsibleError("lookup plugins have to return a list: %r" % items) 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 # hack for apt and soon yum, with_items maps back into a single module call
inject['item'] = ",".join(items) inject['item'] = ",".join(items)
items = None items = None

View file

@ -654,4 +654,9 @@ def get_diff(diff):
except UnicodeDecodeError: except UnicodeDecodeError:
return ">> the files are different, but the diff library cannot compare unicode strings" 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