20688: check for ssh ahead of time, sync only before deploy
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 2 Aug 2023 18:39:20 +0000 (14:39 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 4 Aug 2023 15:25:56 +0000 (11:25 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

tools/salt-install/installer.sh

index 37007da7b66dc44aae4b998b1e7d65fcee25e360..d2f58fd03d68e63ffad8963276d5b9d83c4fc1d7 100755 (executable)
@@ -106,10 +106,13 @@ sync() {
 deploynode() {
     local NODE=$1
     local ROLES=$2
+    local BRANCH=$3
 
     # Deploy a node.  This runs the provision script on the node, with
     # the appropriate roles.
 
+    sync $NODE $BRANCH
+
     if [[ -z "$ROLES" ]] ; then
                echo "No roles specified for $NODE, will deploy all roles"
     else
@@ -289,17 +292,15 @@ case "$subcmd" in
        if [[ -z "$NODE" ]]; then
            for NODE in "${!NODES[@]}"
            do
-               # First, push the git repo to each node.  This also
-               # confirms that we have git and can log into each
-               # node.
-               sync $NODE $BRANCH
+               # First, just confirm we can ssh to each node.
+               `ssh_cmd "$NODE"` $DEPLOY_USER@$NODE true
            done
 
            for NODE in "${!NODES[@]}"
            do
                # Do 'database' role first,
                if [[ "${NODES[$NODE]}" =~ database ]] ; then
-                   deploynode $NODE "${NODES[$NODE]}"
+                   deploynode $NODE "${NODES[$NODE]}" $BRANCH
                    unset NODES[$NODE]
                fi
            done
@@ -326,12 +327,11 @@ case "$subcmd" in
            do
                # Everything else (we removed the nodes that we
                # already deployed from the list)
-               deploynode $NODE "${NODES[$NODE]}"
+               deploynode $NODE "${NODES[$NODE]}" $BRANCH
            done
        else
            # Just deploy the node that was supplied on the command line.
-           sync $NODE $BRANCH
-           deploynode $NODE "${NODES[$NODE]}"
+           deploynode $NODE "${NODES[$NODE]}" $BRANCH
        fi
 
        set +x