summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2016-11-08 21:47:59 -0500
committerGitHub <noreply@github.com>2016-11-08 21:47:59 -0500
commit80b69c4821d8ab61b19a2a89ed743c1cc9c0de5d (patch)
treef098e250aa8dbd7d2f7dd15026aeb64c777a94cd
parentcbc3aac2f2e56975c1ef97702742d0198db25433 (diff)
downloadansible-modules-core-80b69c4821d8ab61b19a2a89ed743c1cc9c0de5d.tar.gz
Correct the handling of state=latest for yum groups. (#4141)
* Correct the handling up state=latest for yum groups. * Use yum-deprecated when available Fixes #4119
-rw-r--r--packaging/os/yum.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/packaging/os/yum.py b/packaging/os/yum.py
index be5e1676..7356880f 100644
--- a/packaging/os/yum.py
+++ b/packaging/os/yum.py
@@ -832,6 +832,7 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
# some guess work involved with groups. update @<group> will install the group if missing
if spec.startswith('@'):
pkgs['update'].append(spec)
+ will_update.add(spec)
continue
# dep/pkgname - find it
else:
@@ -908,14 +909,16 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
if len(pkgs['install']) > 0: # install missing
cmd = yum_basecmd + ['install'] + pkgs['install']
rc, out, err = module.run_command(cmd)
- res['changed'] = True
+ if not out.strip().lower().endswith("no packages marked for update"):
+ res['changed'] = True
else:
rc, out, err = [0, '', '']
if len(will_update) > 0: # update present
cmd = yum_basecmd + ['update'] + pkgs['update']
rc2, out2, err2 = module.run_command(cmd)
- res['changed'] = True
+ if not out2.strip().lower().endswith("no packages marked for update"):
+ res['changed'] = True
else:
rc2, out2, err2 = [0, '', '']
@@ -936,7 +939,14 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo,
disable_gpg_check, exclude, repoq):
- yumbin = module.get_bin_path('yum')
+ # fedora will redirect yum to dnf, which has incompatibilities
+ # with how this module expects yum to operate. If yum-deprecated
+ # is available, use that instead to emulate the old behaviors.
+ if module.get_bin_path('yum-deprecated'):
+ yumbin = module.get_bin_path('yum-deprecated')
+ else:
+ yumbin = module.get_bin_path('yum')
+
# need debug level 2 to get 'Nothing to do' for groupinstall.
yum_basecmd = [yumbin, '-d', '2', '-y']