Skip to content

Commit

Permalink
(PA-6032) add ssh restart for Ubuntu
Browse files Browse the repository at this point in the history
(PA-6032) Changes for Ubuntu 24
  • Loading branch information
skyamgarp committed May 19, 2024
1 parent dbe14d5 commit 6e3826d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/beaker/host/unix/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand Down

0 comments on commit 6e3826d

Please sign in to comment.