Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PUP-11433) Use systemd by default in CentOS/RHEL #8862

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/puppet/provider/service/redhat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"

defaultfor :osfamily => :redhat
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..6).to_a
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2017"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will break some versions of Amazon Linux, as the operatingsystemmajrelease is not always 2017 (at least in some of the versions we test against):

{
        "operatingsystem": "Amazon",
        "operatingsystemmajrelease": "2",
        "operatingsystemrelease": "2",
        "os": {
          "architecture": "x86_64",
          "distro": {
            "codename": "2017.12",
            "description": "Amazon Linux release 2 (2017.12) LTS Release Candidate",
            "id": "Amazon",
            "release": {
              "full": "2",
              "major": "2"
            }
          },
          "family": "RedHat",
          "hardware": "x86_64",
          "name": "Amazon",
          "release": {
            "full": "2",
            "major": "2"
          },
          "selinux": {
            "enabled": false
          }
        },
        "osfamily": "RedHat",
}

Also are there other platforms that report osfamily as RedHat but have a different operatingmajrelease version scheme?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think this will work. For example, on Rocky the osfamily is RedHat but the operatingsystem is Rocky so this provider would no longer be the default for that platform.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kajinamit did you have a chance to see my comment above? Is there another way to do this without breaking defaultfor behavior for existing platforms?

Also we recently merged changes for AL 2023 and it looks like there are conflicts that need resolving.

defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"]

# Remove the symlinks
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/service/systemd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
confine :true => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd')

defaultfor :osfamily => [:archlinux]
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["7", "8", "9"]
defaultfor :osfamily => :redhat
notdefaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..6).to_a
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
defaultfor :osfamily => :suse
defaultfor :osfamily => :coreos
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
notdefaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2017"]
defaultfor :operatingsystem => :debian
notdefaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["5", "6", "7"] # These are using the "debian" method
defaultfor :operatingsystem => :LinuxMint
Expand Down
8 changes: 3 additions & 5 deletions spec/unit/provider/service/redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat')
end

osfamilies = [ 'RedHat' ]

osfamilies.each do |osfamily|
it "should be the default provider on #{osfamily}" do
expect(Facter).to receive(:value).with(:osfamily).and_return(osfamily)
[4, 5, 6].each do |ver|
it "should be the default provider on rhel#{ver}" do
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver)
expect(provider_class.default?).to be_truthy
end
end
Expand Down