summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-11-19 16:04:13 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-11-19 16:04:13 -0800
commit155c41c133b94a2157d92bc1c40edf70242b4bd0 (patch)
tree20cf35cab5bacf64f88f2991de5acba0d99557ea
parent324f7473cd79c2cbd19b851b9b76c4759138e605 (diff)
downloadchef-155c41c133b94a2157d92bc1c40edf70242b4bd0.tar.gz
fix downgrade logic when dealing with arches
when we check "whatinstalled" here we need to have the version completely free, but have the name and arch resolved by the available version logic. then we can compare the versions to see if it needs to downgrade or not. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/yum.rb2
-rw-r--r--lib/chef/provider/package/yum/version.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index e991e4541e..ad045c77e6 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -96,7 +96,7 @@ class Chef
name = av.name # resolve the name via the available/candidate version
- iv = python_helper.package_query(:whatinstalled, name)
+ iv = python_helper.package_query(:whatinstalled, av.name_with_arch)
method = "install"
diff --git a/lib/chef/provider/package/yum/version.rb b/lib/chef/provider/package/yum/version.rb
index b19f52fe09..6ff59009f9 100644
--- a/lib/chef/provider/package/yum/version.rb
+++ b/lib/chef/provider/package/yum/version.rb
@@ -40,6 +40,10 @@ class Chef
"#{version}.#{arch}" unless version.nil?
end
+ def name_with_arch
+ "#{name}.#{arch}" unless name.nil?
+ end
+
def matches_name_and_arch?(other)
other.version == version && other.arch == arch
end