summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-10-09 23:12:49 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-10-09 23:12:49 +0530
commitc77f01affc19e851a792f76a0162b42f99591efc (patch)
treecf4514b359c2f211137ebec5e48e085c3354acc5
parent2e690b43d6d72dd4377e0da6a27a2bc23b8e8109 (diff)
downloadchef-c77f01affc19e851a792f76a0162b42f99591efc.tar.gz
Update exception message
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
-rw-r--r--lib/chef/provider/package/dnf/python_helper.rb7
-rw-r--r--lib/chef/provider/package/yum/python_helper.rb7
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