diff options
-rw-r--r-- | lib/chef/provider/package/dnf/python_helper.rb | 7 | ||||
-rw-r--r-- | lib/chef/provider/package/yum/python_helper.rb | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/chef/provider/package/dnf/python_helper.rb b/lib/chef/provider/package/dnf/python_helper.rb index bd227c79f7..36686f0d71 100644 --- a/lib/chef/provider/package/dnf/python_helper.rb +++ b/lib/chef/provider/package/dnf/python_helper.rb @@ -40,12 +40,9 @@ class Chef # platform-python is used for system tools on RHEL 8 and is installed under /usr/libexec @dnf_command ||= begin cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f| - res = shell_out("#{f} -c 'import dnf'") - raise res.stderr if res.exitstatus != 0 - - true + shell_out("#{f} -c 'import dnf'").exitstatus == 0 end - + raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd "#{cmd} #{DNF_HELPER}" end end diff --git a/lib/chef/provider/package/yum/python_helper.rb b/lib/chef/provider/package/yum/python_helper.rb index b1c4b20ce8..cea58bf0bd 100644 --- a/lib/chef/provider/package/yum/python_helper.rb +++ b/lib/chef/provider/package/yum/python_helper.rb @@ -42,12 +42,9 @@ class Chef def yum_command @yum_command ||= begin cmd = which("platform-python", "python", "python2", "python2.7", extra_path: "/usr/libexec") do |f| - res = shell_out("#{f} -c 'import yum'") - raise res.stderr if res.exitstatus != 0 - - true + shell_out("#{f} -c 'import yum'").exitstatus == 0 end - + raise Chef::Exceptions::Package, "cannot find yum libraries, you may need to use dnf_package" unless cmd "#{cmd} #{YUM_HELPER}" end end |