summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Courtois <b.courtois@criteo.com>2019-06-24 18:58:44 +0200
committerTim Smith <tsmith84@gmail.com>2019-10-02 11:00:13 -0700
commitdffd13373b5d611a03508c57d73b808cd4e26e47 (patch)
treea410c73849f31096447a08810380ad71ac6c287e
parenteb22124bafaab43661bc6ebc0473a973411665ed (diff)
downloadchef-dffd13373b5d611a03508c57d73b808cd4e26e47.tar.gz
Pass yum_package options to underlying python helper
When working with custom repo that are disabled by default, we need to enable them on-demand. The python helper handles that properly but the yum package provider does not pass user's options in all cases. Most of the time there is no issue because in normal cases you should not need to enable any repository to work with "installed" packages. However in some rare cases, you may have multiple installed versions of a given package. In that situation, python libraries used by the helper will do some extra work that may (will) requires to enable the repo. See call to _compare_providers in http://yum.baseurl.org/download/docs/yum-api/3.2.27/yum-pysrc.html#YumBase._bestPackageFromList Not passing the options in that case, will result in an unclear error: > ' * No candidate version available for "package" ' And often will lock/corrupt the rpm db. Signed-off-by: Baptiste Courtois <b.courtois@criteo.com>
-rw-r--r--lib/chef/provider/package/yum.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index e991e4541e..fb2099ea6a 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -93,10 +93,8 @@ class Chef
next if n.nil?
av = available_version(i)
-
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, options: options)
method = "install"
@@ -237,9 +235,9 @@ class Chef
def installed_version(index)
@installed_version ||= []
@installed_version[index] ||= if new_resource.source
- python_helper.package_query(:whatinstalled, available_version(index).name, arch: safe_arch_array[index])
+ python_helper.package_query(:whatinstalled, available_version(index).name, arch: safe_arch_array[index], options: options)
else
- python_helper.package_query(:whatinstalled, package_name_array[index], arch: safe_arch_array[index])
+ python_helper.package_query(:whatinstalled, package_name_array[index], arch: safe_arch_array[index], options: options)
end
@installed_version[index]
end