Skip to content

Commit

Permalink
Assume systemctl as default for restarting sshd.service
Browse files Browse the repository at this point in the history
This also drops support for linux systems without systemd, for example
EL6. But we don't support those anymore since a long time.
  • Loading branch information
bastelfreak committed May 10, 2024
1 parent 96cfe95 commit 497bd17
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/beaker/host/unix/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,12 @@ def clear_env_var key
# @return [Result] result of restarting the SSH service
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]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/
exec(Beaker::Command.new("systemctl restart sshd.service"))
when /el-|centos|fedora|redhat|oracle|scientific|eos/
exec(Beaker::Command.new("/sbin/service sshd restart"))
when /opensuse|sles/
exec(Beaker::Command.new("/usr/sbin/rcsshd restart"))
when /solaris/
exec(Beaker::Command.new("svcadm restart svc:/network/ssh:default"))
when /(free|open)bsd/
exec(Beaker::Command.new("sudo /etc/rc.d/sshd restart"))
else
raise ArgumentError, "Unsupported Platform: '#{self['platform']}'"
exec(Beaker::Command.new("systemctl restart sshd.service"))
end
end

Expand Down

0 comments on commit 497bd17

Please sign in to comment.