From c9af0bfea8e4ef2ef668b8eff2f9986e2543db43 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Wed, 4 Oct 2017 20:48:00 +0200 Subject: [PATCH] yum: fix name parsing out of envra (#31247) (cherry picked from commit 115b4fdc9b30ef881b4ad31a0601eb7350eb2552) --- lib/ansible/modules/packaging/os/yum.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index f24783f2d1..7f17a4ca25 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -1040,8 +1040,8 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, in module.fail_json(**res) nothing_to_do = True - for this in pkglist: - if spec in pkgs['install'] and is_available(module, repoq, this, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): + for pkg in pkglist: + if spec in pkgs['install'] and is_available(module, repoq, pkg, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): nothing_to_do = False break @@ -1049,15 +1049,15 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, in # this contains the full NVR and spec could contain wildcards # or virtual provides (like "python-*" or "smtp-daemon") while # updates contains name only. - this_name_only = '-'.join(this.split('-')[:-2]) - if spec in pkgs['update'] and this_name_only in updates: + pkgname, _, _, _, _ = splitFilename(pkg) + if spec in pkgs['update'] and pkgname in updates: nothing_to_do = False will_update.add(spec) # Massage the updates list - if spec != this_name_only: + if spec != pkgname: # For reporting what packages would be updated more # succinctly - will_update_from_other_package[spec] = this_name_only + will_update_from_other_package[spec] = pkgname break if nothing_to_do: