From 6e3826dfe4ac584719f36080c4b308818791bff2 Mon Sep 17 00:00:00 2001 From: skyamgarp <130442619+skyamgarp@users.noreply.github.com> Date: Fri, 17 May 2024 21:20:58 +0530 Subject: [PATCH] (PA-6032) add ssh restart for Ubuntu (PA-6032) Changes for Ubuntu 24 --- lib/beaker/host/unix/exec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/beaker/host/unix/exec.rb b/lib/beaker/host/unix/exec.rb index 4dd481bff..4f672f461 100644 --- a/lib/beaker/host/unix/exec.rb +++ b/lib/beaker/host/unix/exec.rb @@ -278,6 +278,8 @@ def clear_env_var key # @return [Result] result of restarting the SSH service def ssh_service_restart case self['platform'] + when /ubuntu-24.04-amd64/ + exec(Beaker::Command.new("systemctl restart ssh")) when /(el|centos|redhat|oracle|scientific)-[0-6]/ exec(Beaker::Command.new("/sbin/service sshd restart")) when /solaris/ @@ -300,7 +302,7 @@ def ssh_permit_user_environment directory = tmpdir exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit")) exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config")) - exec(Beaker::Command.new("echo '' >/etc/environment")) if /ubuntu-2(0|2).04/.match?(self['platform']) + exec(Beaker::Command.new("echo '' >/etc/environment")) if /ubuntu-2(0|2|4).04/.match?(self['platform']) when /(free|open)bsd/ exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), { :pty => true }) else