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

(PA-6032) Remove Ubuntu architecture

(PA-6032) Changes for Ubuntu and debian for ssh restart
  • Loading branch information
skyamgarp committed May 21, 2024
1 parent 7053494 commit 450da25
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 /debian|ubuntu/
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 @@ -302,7 +304,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 450da25

Please sign in to comment.