21678: Adds 'diagnostics-internal' subcommand to installer.sh
[arvados.git] / tools / salt-install / installer.sh
index 439293c2967325318adfe76f8c46b67ee607edc8..a62a780032ca2b9531e139e39acc4d37e3d0ca20 100755 (executable)
@@ -449,14 +449,33 @@ diagnostics)
   arvados-client diagnostics $LOCATION
   ;;
 
+diagnostics-internal)
+  loadconfig
+  set -u
+
+  if [ -z "${ROLE2NODES['shell']:-}" ]; then
+    echo "No node with 'shell' role was found, cannot run diagnostics-internal"
+    exit 1
+  fi
+
+  # Pick the first shell node for test running
+  declare TESTNODE=$(echo ${ROLE2NODES['shell']} | cut -d\, -f1)
+
+  # Run diagnostics
+  declare SSH=$(ssh_cmd "$TESTNODE")
+  echo "Running diagnostics on $TESTNODE ..."
+  $SSH $DEPLOY_USER@$TESTNODE "sudo ARVADOS_API_HOST=${DOMAIN}:${CONTROLLER_EXT_SSL_PORT} ARVADOS_API_TOKEN=$SYSTEM_ROOT_TOKEN arvados-client diagnostics -internal-client"
+  ;;
+
 *)
   echo "Arvados installer"
   echo ""
-  echo "initialize        initialize the setup directory for configuration"
-  echo "terraform         create cloud resources using terraform"
-  echo "terraform-destroy destroy cloud resources created by terraform"
-  echo "generate-tokens   generate random values for tokens"
-  echo "deploy            deploy the configuration from the setup directory"
-  echo "diagnostics       check your install using diagnostics"
+  echo "initialize             initialize the setup directory for configuration"
+  echo "terraform              create cloud resources using terraform"
+  echo "terraform-destroy      destroy cloud resources created by terraform"
+  echo "generate-tokens        generate random values for tokens"
+  echo "deploy                 deploy the configuration from the setup directory"
+  echo "diagnostics            check your install running diagnostics locally"
+  echo "diagnostics-internal   check your install running diagnostics on a shell node"
   ;;
 esac