18870: Change deploy target directory name
[arvados.git] / tools / salt-install / installer.sh
index 12efc3eab430dd9758dd5def2e119b50d3e84b52..1db9ce7bd5f70433e5aa0488e29e68d81beb9e12 100755 (executable)
@@ -6,20 +6,22 @@
 
 set -e
 
+declare -A NODES
+
 sync() {
     if test "$NODE" != localhost ; then
-       if ! ssh $NODE test -d arvados-setup ; then
-           ssh $NODE git init --bare arvados-setup.git
-           if ! git remote add $NODE $DEPLOY_USER@$NODE:arvados-setup.git ; then
-               git remote set-url $NODE $DEPLOY_USER@$NODE:arvados-setup.git
+       if ! ssh $NODE test -d ${TARGET}.git ; then
+           ssh $NODE git init --bare ${GITTARGET}.git
+           if ! git remote add $NODE $DEPLOY_USER@$NODE:${GITTARGET}.git ; then
+               git remote set-url $NODE $DEPLOY_USER@$NODE:${GITTARGET}.git
            fi
            git push $NODE $BRANCH
-           ssh $NODE git clone arvados-setup.git arvados-setup
+           ssh $NODE git clone ${GITTARGET}.git ${GITTARGET}
        fi
 
        git push $NODE $BRANCH
-       ssh $NODE git -C arvados-setup checkout $BRANCH
-       ssh $NODE git -C arvados-setup pull
+       ssh $NODE git -C ${GITTARGET} checkout $BRANCH
+       ssh $NODE git -C ${GITTARGET} pull
     fi
 }
 
@@ -32,8 +34,17 @@ deploynode() {
     if test $NODE = localhost ; then
        sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}
     else
-       ssh $DEPLOY_USER@$NODE "cd arvados-setup && sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}"
+       ssh $DEPLOY_USER@$NODE "cd ${GITTARGET} && sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}"
+    fi
+}
+
+loadconfig() {
+    CONFIG_FILE=local.params
+    if ! test -s $CONFIG_FILE ; then
+       echo "Must be run from initialized setup dir, maybe you need to 'initialize' first?"
     fi
+    source ${CONFIG_FILE}
+    GITTARGET=arvados-deploy-config-${CLUSTER}
 }
 
 subcmd="$1"
@@ -88,12 +99,8 @@ case "$subcmd" in
        ;;
     deploy)
        NODE=$1
-       CONFIG_FILE=local.params
-       if ! test -s $CONFIG_FILE ; then
-           echo "Must be run from arvados-setup, maybe you need to 'initialize' first?"
-       fi
 
-       source ${CONFIG_FILE}
+       loadconfig
 
        set -x
 
@@ -114,11 +121,25 @@ case "$subcmd" in
            sync
            deploynode
        fi
+
+       ;;
+    diagnostics)
+       loadconfig
+
+       if ! which arvados-client ; then
+           apt-get install arvados-client
+       fi
+
+       export ARVADOS_API_HOST="${CLUSTER}.${DOMAIN}"
+       export ARVADOS_API_TOKEN="$SYSTEM_ROOT_TOKEN"
+
+       arvados-client diagnostics -internal-client
        ;;
     *)
        echo "Arvados installer"
        echo ""
        echo "initialize   initialize the setup directory for configuration"
        echo "deploy       deploy the configuration from the setup directory"
+       echo "diagnostics  check your install using diagnostics"
        ;;
 esac