Skip to content

Commit

Permalink
Merge pull request #9132 from vchepkov/amazon2023-7.x
Browse files Browse the repository at this point in the history
(PUP-11976) adjust package/service providers for Amazon Linux 2023 for puppet 7.x
  • Loading branch information
mhashizume committed Oct 26, 2023
2 parents fec6702 + 282debb commit a980249
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/puppet/provider/package/dnf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
notdefaultfor :operatingsystem => :fedora, :operatingsystemmajrelease => (19..21).to_a
defaultfor :osfamily => :redhat
notdefaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2023"]

def self.update_command
# In DNF, update is deprecated for upgrade
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/provider/service/systemd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
defaultfor :osfamily => :suse
defaultfor :osfamily => :coreos
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2", "2023"]
defaultfor :operatingsystem => :debian
notdefaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["5", "6", "7"] # These are using the "debian" method
defaultfor :operatingsystem => :LinuxMint
Expand All @@ -39,8 +39,8 @@ def self.instances
return []
end

# Static services cannot be enabled or disabled manually. Indirect services
# should not be enabled or disabled due to limitations in systemd (see
# Static services cannot be enabled or disabled manually. Indirect services
# should not be enabled or disabled due to limitations in systemd (see
# https://github.com/systemd/systemd/issues/6681).
def enabled_insync?(current)
case cached_enabled?[:output]
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/provider/package/dnf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8")
expect(described_class).to be_default
end

it "should be the default provider on Amazon Linux 2023" do
allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon)
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2023")
expect(described_class).to be_default
end
end

describe 'provider features' do
Expand Down
12 changes: 7 additions & 5 deletions spec/unit/provider/service/systemd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@
end
end

it "should be the default provider on Amazon Linux 2.0" do
allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon)
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2")
expect(provider_class).to be_default
[ 2, 2023 ].each do |ver|
it "should be the default provider on Amazon Linux #{ver}" do
allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon)
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}")
expect(provider_class).to be_default
end
end

it "should not be the default provider on Amazon Linux 2017.09" do
Expand Down

0 comments on commit a980249

Please sign in to comment.