18870: Fix diagnostic
[arvados.git] / tools / salt-install / installer.sh
index 6fdd0320feb0370a54752a6bba1c1e069167d1ca..fde261611cfe553375658291779a7a29f4a22b26 100755 (executable)
@@ -7,9 +7,7 @@
 set -e
 
 sync() {
-    if test $NODE = localhost ; then
-       # nothing to do
-    else
+    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
@@ -22,6 +20,7 @@ sync() {
        git push $NODE $BRANCH
        ssh $NODE git -C arvados-setup checkout $BRANCH
        ssh $NODE git -C arvados-setup pull
+    fi
 }
 
 deploynode() {
@@ -37,6 +36,14 @@ deploynode() {
     fi
 }
 
+loadconfig() {
+    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}
+}
+
 subcmd="$1"
 if test -n "$subcmd" ; then
     shift
@@ -89,12 +96,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
 
@@ -115,11 +118,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