diff options
author | Baptiste Courtois <b.courtois@criteo.com> | 2019-06-24 18:58:44 +0200 |
---|---|---|
committer | Baptiste Courtois <b.courtois@criteo.com> | 2019-06-24 21:17:24 +0200 |
commit | 80188e70f6c330bf6257206c67a27c9b84a86e98 (patch) | |
tree | ce3af6ee4ac7335d40c3befca2861a6a10e70fc0 | |
parent | fdbdc97b7f7bace8df63f11d452de4ff26567e6d (diff) | |
download | chef-80188e70f6c330bf6257206c67a27c9b84a86e98.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.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 55f478745c..74343fa10d 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, av.name_with_arch) + 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 |