X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a86028d71e9560db5055e4fb8741b65675c9fe4b..58582ec6765abcbed322d0035eb099a6dde426e5:/tools/salt-install/provision.sh diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh index 3c5fb41e0f..173ed15b68 100755 --- a/tools/salt-install/provision.sh +++ b/tools/salt-install/provision.sh @@ -12,17 +12,6 @@ set -o pipefail -_exit_handler() { - local rc="$?" - trap - EXIT - if [ "$rc" -ne 0 ]; then - echo "Error occurred ($rc) while running $0 at line $1 : $BASH_COMMAND" - fi - exit "$rc" -} - -trap '_exit_handler $LINENO' EXIT ERR - # capture the directory that the script is running from SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" @@ -237,6 +226,8 @@ T_DIR="/tmp/cluster_tests" arguments ${@} +declare -A NODES + if [ -s ${CONFIG_FILE} ]; then source ${CONFIG_FILE} else @@ -255,7 +246,7 @@ if [ ! -d ${CONFIG_DIR} ]; then exit 1 fi -if grep -q 'fixme_or_this_wont_work' ${CONFIG_FILE} ; then +if grep -rni 'fixme' ${CONFIG_FILE} ${CONFIG_DIR} ; then echo >&2 "The config file ${CONFIG_FILE} has some parameters that need to be modified." echo >&2 "Please, fix them and re-run the provision script." exit 1 @@ -364,9 +355,9 @@ echo "...arvados" git clone --quiet https://git.arvados.org/arvados-formula.git ${F_DIR}/arvados # If we want to try a specific branch of the formula -if [ "x${BRANCH}" != "x" -a $(git rev-parse --abbrev-ref HEAD) != "${BRANCH}" ]; then +if [ "x${BRANCH}" != "x" ]; then ( cd ${F_DIR}/arvados && git checkout --quiet -t origin/"${BRANCH}" -b "${BRANCH}" ) -elif [ "x${ARVADOS_TAG}" != "x" -a $(git rev-parse --abbrev-ref HEAD) != "${ARVADOS_TAG}" ]; then +elif [ "x${ARVADOS_TAG}" != "x" ]; then ( cd ${F_DIR}/arvados && git checkout --quiet tags/"${ARVADOS_TAG}" -b "${ARVADOS_TAG}" ) fi @@ -623,7 +614,7 @@ if [ -z "${ROLES}" ]; then echo "extra_custom_certs_dir: /srv/salt/certs" > ${P_DIR}/extra_custom_certs.sls echo "extra_custom_certs:" >> ${P_DIR}/extra_custom_certs.sls - for c in controller websocket workbench workbench2 webshell keepweb keepproxy; do + for c in controller websocket workbench workbench2 webshell keepweb keepproxy shell; do # Are we in a single-host-single-hostname env? if [ "${USE_SINGLE_HOSTNAME}" = "yes" ]; then # Are we in a single-host-single-hostname env? @@ -704,7 +695,6 @@ else sed -i "s/__NGINX_INSTALL_SOURCE__/${NGINX_INSTALL_SOURCE}/g" ${P_DIR}/nginx_passenger.sls ;; "controller" | "websocket" | "workbench" | "workbench2" | "webshell" | "keepweb" | "keepproxy") - NGINX_INSTALL_SOURCE="install_from_repo" # States if [ "${R}" = "workbench" ]; then NGINX_INSTALL_SOURCE="install_from_phusionpassenger" @@ -785,7 +775,7 @@ else s#__CERT_PEM__#/etc/nginx/ssl/arvados-${R}.pem#g; s#__CERT_KEY__#/etc/nginx/ssl/arvados-${R}.key#g" \ ${P_DIR}/nginx_${R}_configuration.sls - grep -q ${R}$ ${P_DIR}/extra_custom_certs.sls || echo " - ${R}" >> ${P_DIR}/extra_custom_certs.sls + grep -q ${R} ${P_DIR}/extra_custom_certs.sls || echo " - ${R}" >> ${P_DIR}/extra_custom_certs.sls fi fi # We need to tweak the Nginx's pillar depending whether we want plain nginx or nginx+passenger @@ -830,17 +820,15 @@ fi # Leave a copy of the Arvados CA so the user can copy it where it's required if [ "$DEV_MODE" = "yes" ]; then - ARVADOS_SNAKEOIL_CA_DEST_FILE="${SCRIPT_DIR}/${CLUSTER}.${DOMAIN}-arvados-snakeoil-ca.pem" - + echo "Copying the Arvados CA certificate to the installer dir, so you can import it" # If running in a vagrant VM, also add default user to docker group if [ "x${VAGRANT}" = "xyes" ]; then + cp /etc/ssl/certs/arvados-snakeoil-ca.pem /vagrant/${CLUSTER}.${DOMAIN}-arvados-snakeoil-ca.pem + echo "Adding the vagrant user to the docker group" usermod -a -G docker vagrant - ARVADOS_SNAKEOIL_CA_DEST_FILE="/vagrant/${CLUSTER}.${DOMAIN}-arvados-snakeoil-ca.pem" - fi - if [ -f /etc/ssl/certs/arvados-snakeoil-ca.pem ]; then - echo "Copying the Arvados CA certificate to the installer dir, so you can import it" - cp /etc/ssl/certs/arvados-snakeoil-ca.pem ${ARVADOS_SNAKEOIL_CA_DEST_FILE} + else + cp /etc/ssl/certs/arvados-snakeoil-ca.pem ${SCRIPT_DIR}/${CLUSTER}.${DOMAIN}-arvados-snakeoil-ca.pem fi fi