Skip to content

Commit

Permalink
Drop Fedora < 22 support
Browse files Browse the repository at this point in the history
Those are long EOL and this makes sure the right commands on Fedora 40
are used.
  • Loading branch information
ekohl committed May 10, 2024
1 parent 1785af9 commit 2a50e6a
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 78 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions lib/beaker/host/unix/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ def ssh_service_restart
case self['platform']
when /debian|ubuntu/
exec(Beaker::Command.new("service ssh restart"))
when /amazon|(el|centos|redhat|oracle|scientific)-[7-9]|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/
when /amazon|(el|centos|redhat|oracle|scientific)-[7-9]|fedora|archlinux-/
exec(Beaker::Command.new("systemctl restart sshd.service"))
when /el-|centos|fedora|redhat|oracle|scientific/
when /el-|centos|redhat|oracle|scientific/
exec(Beaker::Command.new("/sbin/service sshd restart"))
when /opensuse|sles/
exec(Beaker::Command.new("/usr/sbin/rcsshd restart"))
Expand Down
4 changes: 2 additions & 2 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def upgrade_package(name, cmdline_args = '', opts = {})
case self['platform']
when /opensuse|sles-/
execute("zypper --non-interactive --no-gpg-checks up #{name}", opts)
when /fedora-(2[2-9]|3[0-9])/
when /fedora/
execute("dnf -y #{cmdline_args} update #{name}", opts)
when /fedora|centos|redhat|el-/
when /centos|redhat|el-/
execute("yum -y #{cmdline_args} update #{name}", opts)
when /ubuntu|debian/
update_apt_if_needed
Expand Down
4 changes: 2 additions & 2 deletions lib/beaker/host_prebuilt_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ def enable_root_login host, opts
# restart sshd
if /debian|ubuntu/.match?(host['platform'])
host.exec(Command.new("sudo su -c \"service ssh restart\""), { :pty => true })
elsif /amazon|arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform'])
elsif /amazon|arch|(centos|el|redhat)-[789]|fedora/.match?(host['platform'])
host.exec(Command.new("sudo -E systemctl restart sshd.service"), { :pty => true })
elsif /centos|el-|redhat|fedora/.match?(host['platform'])
elsif /centos|el-|redhat/.match?(host['platform'])
host.exec(Command.new("sudo -E /sbin/service sshd reload"), { :pty => true })
elsif /(free|open)bsd/.match?(host['platform'])
host.exec(Command.new("sudo /etc/rc.d/sshd restart"))
Expand Down
7 changes: 6 additions & 1 deletion spec/beaker/host_prebuilt_steps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@
]
end

['centos', 'el-', 'redhat', 'fedora'].each do |redhat_like|
['centos', 'el-', 'redhat'].each do |redhat_like|
it_behaves_like 'enables_root_login', redhat_like, [
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
"sudo -E /sbin/service sshd reload",
]
end

it_behaves_like 'enables_root_login', 'fedora', [
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
"sudo -E systemctl restart sshd.service",
]

context 'timesync' do
subject { dummy_class.new }

Expand Down
10 changes: 3 additions & 7 deletions spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ def make_instance instance_data = {}
module PlatformHelpers
DEBIANPLATFORMS = %w[debian ubuntu]

FEDORASYSTEMD = (14..39).to_a.collect! { |i| "fedora-#{i}" }

SYSTEMDPLATFORMS = %w[amazon-2023
fedora
el-7
centos-7
redhat-7
Expand All @@ -133,14 +132,11 @@ module PlatformHelpers
el-8
centos-8
redhat-8
oracle-8].concat(FEDORASYSTEMD)

FEDORASYSTEMV = (1..13).to_a.collect! { |i| "fedora-#{i}" }
oracle-8]

SYSTEMVPLATFORMS = ['el-',
'centos',
'fedora',
'redhat',
'oracle',
'scientific',].concat(FEDORASYSTEMV)
'scientific',]
end

0 comments on commit 2a50e6a

Please sign in to comment.