Only run yum,apt through the with_items loop if there is a list of items. Just a cosmetic fix on return values
for the most part.
This commit is contained in:
parent
2f6d6ccb5a
commit
c82f06258c
3 changed files with 2 additions and 2 deletions
|
@ -14,6 +14,7 @@ Ansible Changes By Release
|
||||||
* YAML syntax errors detected and show where the problem is
|
* YAML syntax errors detected and show where the problem is
|
||||||
* better changed=True/False detection in user module on older Linux distros
|
* better changed=True/False detection in user module on older Linux distros
|
||||||
* when using paramiko and SFTP is not accessible, do not traceback, but return a nice human readable msg
|
* when using paramiko and SFTP is not accessible, do not traceback, but return a nice human readable msg
|
||||||
|
* nicer errors from modules when arguments are not key=value
|
||||||
|
|
||||||
0.6 "Cabo" -- August 6, 2012
|
0.6 "Cabo" -- August 6, 2012
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ class Runner(object):
|
||||||
if type(items) != list:
|
if type(items) != list:
|
||||||
raise errors.AnsibleError("with_items only takes a list: %s" % items)
|
raise errors.AnsibleError("with_items only takes a list: %s" % items)
|
||||||
|
|
||||||
if self.module_name in [ 'apt', 'yum' ]:
|
if len(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 = []
|
items = []
|
||||||
|
|
|
@ -112,7 +112,6 @@ def list_stuff(conf_file, stuff):
|
||||||
if conf_file and os.path.exists(conf_file):
|
if conf_file and os.path.exists(conf_file):
|
||||||
repoq = '%s -c %s --plugins --quiet -q ' % (repoquery,conf_file)
|
repoq = '%s -c %s --plugins --quiet -q ' % (repoquery,conf_file)
|
||||||
|
|
||||||
|
|
||||||
if stuff == 'installed':
|
if stuff == 'installed':
|
||||||
return [ pkg_to_dict(p) for p in is_installed(repoq, '-a', qf=qf) if p.strip() ]
|
return [ pkg_to_dict(p) for p in is_installed(repoq, '-a', qf=qf) if p.strip() ]
|
||||||
elif stuff == 'updates':
|
elif stuff == 'updates':
|
||||||
|
|
Loading…
Reference in a new issue