Skip to content

Commit a35e4bd

Browse files
committed
Add additional Docker provisioner OS support
- Add EL 9 support - Add SLES support
1 parent 03cc0ad commit a35e4bd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tasks/docker.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def install_ssh_components(distro, version, container)
2828
'yum clean all; '\
2929
'yum install -y sudo openssh-server openssh-clients"')
3030
else
31+
# If systemd is running for init, ensure systemd has finished starting up before proceeding:
32+
check_init_cmd = 'if [[ "$(readlink /proc/1/exe)" == "/usr/lib/systemd/systemd" ]]; then '\
33+
'count=0 ; while [[ "$(systemctl is-system-running)" =~ ^running|degraded$ && $count < 20 ]]; '\
34+
'do sleep 0.1 ; count=$((count+1)) ; done ; fi'
35+
run_local_command("docker exec #{container} bash -c '#{check_init_cmd}'")
3136
run_local_command("docker exec #{container} yum install -y sudo openssh-server openssh-clients")
3237
end
3338
ssh_folder = run_local_command("docker exec #{container} ls /etc/ssh/")
@@ -68,11 +73,13 @@ def fix_ssh(distro, version, container)
6873
# https://bugzilla.redhat.com/show_bug.cgi?id=1728777
6974
run_local_command("docker exec #{container} sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd") if distro =~ %r{redhat|centos} && version =~ %r{^7}
7075

71-
if !%r{^(7|8|2)}.match?(version)
76+
if !%r{^(7|8|9|2)}.match?(version)
7277
run_local_command("docker exec #{container} service sshd restart")
7378
else
7479
run_local_command("docker exec #{container} /usr/sbin/sshd")
7580
end
81+
when %r{sles}
82+
run_local_command("docker exec #{container} /usr/sbin/sshd")
7683
else
7784
raise "distribution #{distro} not yet supported on docker"
7885
end

0 commit comments

Comments
 (0)