summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2019-06-13 11:32:06 -0400
committerChris Evich <cevich@redhat.com>2019-06-14 15:47:07 -0400
commitab3105a46d18136c8be7416b46100df23282b9a1 (patch)
treee5865bd4c09168c7b8a44e01403bc4cef59910c7
parent11484580d35c7310242303fa0728e3681462f37f (diff)
downloadpodman-ab3105a46d18136c8be7416b46100df23282b9a1.tar.gz
podman-ab3105a46d18136c8be7416b46100df23282b9a1.tar.bz2
podman-ab3105a46d18136c8be7416b46100df23282b9a1.zip
Cirrus: Fix F30 ssh guarantee
The original solution using --wait does not function on F30, waiting forever. Replace it with a simple 5-minute timeout loop. Signed-off-by: Chris Evich <cevich@redhat.com>
-rw-r--r--contrib/cirrus/lib.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 98685faa9..30141db67 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -208,8 +208,25 @@ setup_rootless() {
# Works with older versions of bash
printf "${_env_var_name}=%q\n" "$(printenv $_env_var_name)" >> "/home/$ROOTLESS_USER/.bashrc"
done
- echo "Ensure the systems ssh process is up and running"
- systemctl --wait restart sshd # a regular 'start' could hang forever
+
+ echo "Ensure the systems ssh process is up and running within 5 minutes"
+ systemctl start sshd
+ NOW=$(date +%s)
+ TIMEOUT=$(date --date '+5 minutes' +%s)
+ while [[ "$(date +%s)" -lt "$TIMEOUT" ]]
+ do
+ if timeout --foreground -k 1s 1s \
+ ssh $ROOTLESS_USER@localhost \
+ -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no \
+ true
+ then
+ break
+ else
+ sleep 2s
+ fi
+ done
+ [[ "$(date +%s)" -lt "$TIMEOUT" ]] || \
+ die 11 "Timeout exceeded waiting for localhost ssh capability"
}
# Helper/wrapper script to only show stderr/stdout on non-zero exit