You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
puppet/0005-PUP-9198-Add-RHEL8-sup...

53 lines
1.8 KiB

From 8cf4f5cb49ac3742c0c650f81875872ac3e09fbb Mon Sep 17 00:00:00 2001
From: Alex Schultz <aschultz@redhat.com>
Date: Wed, 3 Oct 2018 12:55:30 -0600
Subject: [PATCH 5/5] (PUP-9198) Add RHEL8 support in the dnf provider
dnf should be the default for RHEL8
---
lib/puppet/provider/package/dnf.rb | 1 +
spec/unit/provider/package/dnf_spec.rb | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/lib/puppet/provider/package/dnf.rb b/lib/puppet/provider/package/dnf.rb
index c0ed877..ee27322 100644
--- a/lib/puppet/provider/package/dnf.rb
+++ b/lib/puppet/provider/package/dnf.rb
@@ -29,6 +29,7 @@ Puppet::Type.type(:package).provide :dnf, :parent => :yum do
end
defaultfor :operatingsystem => :fedora
+ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["8"]
def self.update_command
# In DNF, update is deprecated for upgrade
diff --git a/spec/unit/provider/package/dnf_spec.rb b/spec/unit/provider/package/dnf_spec.rb
index 5e57337..40345dc 100644
--- a/spec/unit/provider/package/dnf_spec.rb
+++ b/spec/unit/provider/package/dnf_spec.rb
@@ -23,6 +23,21 @@ context 'default' do
expect(provider_class).to be_default
end
end
+
+ it "should not be the default provider on rhel7" do
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
+ expect(provider_class).to_not be_default
+ end
+
+ it "should be the default provider on rhel8" do
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8")
+ expect(provider_class).to be_default
+ end
+
end
describe provider_class do
--
2.19.2