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

yum: remove duplicite code introduced in d1fa210be (#28511)

This commit is contained in:
Martin Krizek 2017-08-22 16:03:50 -04:00 committed by René Moser
parent cbb94a75fe
commit c59f3f841e

View file

@ -1086,33 +1086,15 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, in
if cmd: # update all if cmd: # update all
rc, out, err = module.run_command(cmd) rc, out, err = module.run_command(cmd)
res['changed'] = True res['changed'] = True
else: elif len(pkgs['install']) or len(will_update):
if len(pkgs['install']) > 0: # install missing cmd = yum_basecmd + ['install'] + pkgs['install'] + pkgs['update']
cmd = yum_basecmd + ['install'] + pkgs['install'] rc, out, err = module.run_command(cmd)
rc, out, err = module.run_command(cmd) out_lower = out.strip().lower()
out_lower = out.strip().lower() if not out_lower.endswith("no packages marked for update") and \
if not out_lower.endswith("no packages marked for update") and \ not out_lower.endswith("nothing to do"):
not out_lower.endswith("nothing to do"): res['changed'] = True
res['changed'] = True
else:
rc, out, err = [0, '', '']
if len(will_update) > 0: # update present res['rc'] = rc
cmd = yum_basecmd + ['install'] + pkgs['update']
rc2, out2, err2 = module.run_command(cmd)
out2_lower = out2.strip().lower()
if not out2_lower.endswith("no packages marked for update") and \
not out2_lower.endswith("nothing to do"):
res['changed'] = True
else:
rc2, out2, err2 = [0, '', '']
if not update_all:
rc += rc2
out += out2
err += err2
res['rc'] += rc
res['msg'] += err res['msg'] += err
res['results'].append(out) res['results'].append(out)