From 8832094fd1614ecda537ac3268d6d3127dfc76fa Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 10 May 2024 15:38:04 +0200 Subject: [PATCH] Assume systemctl as default for restarting sshd.service This also drops support for linux systems without systemd, for example EL6. But we don't support those anymore since a long time. --- lib/beaker/host/unix/exec.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/beaker/host/unix/exec.rb b/lib/beaker/host/unix/exec.rb index feceb9897..68f723be1 100644 --- a/lib/beaker/host/unix/exec.rb +++ b/lib/beaker/host/unix/exec.rb @@ -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]|fedora|archlinux-/ - exec(Beaker::Command.new("systemctl restart sshd.service")) - 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")) 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