diff --git a/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh b/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh index ca86980..678d467 100755 --- a/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh +++ b/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh @@ -97,12 +97,14 @@ remote() { quoted_cmd="$(printf '%q' "$cmd")" for candidate in "${candidates[@]}"; do - if ssh $SSH_OPTS "$candidate@$host_ip" "bash -lc $quoted_cmd"; then + ssh $SSH_OPTS "$candidate@$host_ip" "bash -lc $quoted_cmd" + rc=$? + + if [ "$rc" -eq 0 ]; then ACTIVE_SSH_USER="$candidate" return 0 fi - rc=$? if [ "$rc" -ne 255 ]; then return "$rc" fi