Skip to content

Commit

Permalink
Fixed hangups during deployment due to stuck ssh sessions.
Browse files Browse the repository at this point in the history
  • Loading branch information
asdaraujo committed Jul 18, 2024
1 parent fe9961d commit 080e0e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup/terraform/check-setup-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function ensure_control_master() {
fi

(
timeout 60 "ssh -q -o StrictHostKeyChecking=no -f -N -M -o ControlPersist=2h -S '${CONTROL_PATH_PREFIX}.${id}' -i '$pvt_key' "$TF_VAR_ssh_username"@$ip" &
timeout 60 "ssh -q -o StrictHostKeyChecking=no -f -N -M -o ControlPersist=2h -S '${CONTROL_PATH_PREFIX}.${id}' -i '$pvt_key' "$TF_VAR_ssh_username"@$ip" 2> /dev/null &
echo $! > "$pid_file"
wait
rm -f "$pid_file"
Expand All @@ -91,7 +91,7 @@ function check_instance() {
return
fi

ssh -q -S "${CONTROL_PATH_PREFIX}.${id}" "$TF_VAR_ssh_username"@$ip "$cmd" > "${STATUS_FILE_PREFIX}.${id}.tmp"
ssh -o ServerAliveInterval=10 -o ServerAliveCountMax=5 -q -S "${CONTROL_PATH_PREFIX}.${id}" "$TF_VAR_ssh_username"@$ip "$cmd" > "${STATUS_FILE_PREFIX}.${id}.tmp" || true
if [[ $? == 0 ]]; then
awk -v IP="$ip" -v ID="$id" -v KEY="$pvt_key" -v UNKNOWN="$STATUS_UNKNOWN" '{status=$1; if (status == "") {status=UNKNOWN}; gsub(/.*STATUS:/, "STATUS:"); print status" "ID" "IP" "KEY" "$0}' "${STATUS_FILE_PREFIX}.${id}.tmp"
fi
Expand Down

0 comments on commit 080e0e7

Please sign in to comment.