summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-10-12 10:41:24 -0700
committerGitHub <noreply@github.com>2017-10-12 10:41:24 -0700
commit9f0e99728baddbcd2295145374fd45432968845b (patch)
tree6ea5d35185da9856b272e1ed7b88e48f11f990a5
parent68957b1fb3b29cbfe051fb4fe6ad15219f54ad5a (diff)
parent7d0b0c7fff04cc541d12b64116ba598e80f776c9 (diff)
downloadchef-9f0e99728baddbcd2295145374fd45432968845b.tar.gz
Merge pull request #6492 from chef/lcg/dnf-platform-tweaks-backport
backport of #6490
-rw-r--r--lib/chef/provider/package/dnf.rb15
-rw-r--r--lib/chef/resource/dnf_package.rb13
2 files changed, 19 insertions, 9 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb
index 1ee8f119c4..7e61aa810e 100644
--- a/lib/chef/provider/package/dnf.rb
+++ b/lib/chef/provider/package/dnf.rb
@@ -35,13 +35,18 @@ class Chef
use_multipackage_api
use_package_name_for_source
- provides :package, platform_family: %w{fedora} do
- which("dnf") && shell_out("rpm -q dnf").stdout =~ /^dnf-[1-9]/
- end
+ # all rhel variants >= 8 will use DNF
+ provides :package, platform_family: "rhel", platform: "!amazon", platform_version: ">= 8"
+
+ # fedora >= 22 uses DNF
+ provides :package, platform: "fedora", platform_version: ">= 22"
- provides :package, platform_family: %w{rhel}, platform_version: ">= 8"
+ # amazon will eventually use DNF
+ provides :package, platform: "amazon" do
+ which("dnf")
+ end
- provides :dnf_package, os: "linux"
+ provides :dnf_package
#
# Most of the magic in this class happens in the python helper script. The ruby side of this
diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb
index 2aea2c4457..c48ef45ec0 100644
--- a/lib/chef/resource/dnf_package.rb
+++ b/lib/chef/resource/dnf_package.rb
@@ -29,11 +29,16 @@ class Chef
allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache
- provides :package, platform_family: %w{fedora} do
- which("dnf") && shell_out("rpm -q dnf").stdout =~ /^dnf-[1-9]/
- end
+ # all rhel variants >= 8 will use DNF
+ provides :package, platform_family: "rhel", platform: "!amazon", platform_version: ">= 8"
+
+ # fedora >= 22 uses DNF
+ provides :package, platform: "fedora", platform_version: ">= 22"
- provides :package, platform_family: %{rhel}, platform_version: ">8"
+ # amazon will eventually use DNF
+ provides :package, platform: "amazon" do
+ which("dnf")
+ end
provides :dnf_package