From 1fae94f6f1d7d8f570a5ed5a15ee90fb1b490474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Sun, 28 Nov 2021 18:40:51 +0100 Subject: [PATCH] misc: Minor improvements --- assets/runtime/functions.sh | 1 + entrypoint.sh | 6 ++++-- tests/gitfs/test.sh | 6 +++--- tests/lib/common.sh | 2 +- tests/salt-api/test.sh | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/assets/runtime/functions.sh b/assets/runtime/functions.sh index bb4d428..e8a2774 100755 --- a/assets/runtime/functions.sh +++ b/assets/runtime/functions.sh @@ -217,6 +217,7 @@ function configure_salt_master() #---------------------------------------------------------------------------------------------------------------------- function configure_salt_api() { + rm -f /etc/supervisor/conf.d/salt-api.conf [[ ${SALT_API_SERVICE_ENABLED} == true ]] || return 0 if [[ -n "${SALT_API_USER}" ]]; then diff --git a/entrypoint.sh b/entrypoint.sh index e820d04..e922961 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,9 @@ set -e set -o pipefail -source "${SALT_RUNTIME_DIR}/functions.sh" +# shellcheck source=assets/runtime/functions.sh +FUNCTIONS_FILE="${SALT_RUNTIME_DIR}/functions.sh" +source "${FUNCTIONS_FILE}" [[ "${DEBUG}" == true ]] && set -x @@ -28,7 +30,7 @@ case "${1}" in case "${1}" in salt-master|salt-api) echo "Restarting ${1} service ..." - exec pkill "${1}" + exec supervisorctl restart "${1}" ;; *) log_error "Unable to restart ${1} serice. Service is unknown" diff --git a/tests/gitfs/test.sh b/tests/gitfs/test.sh index 3600fc6..8fc61d5 100755 --- a/tests/gitfs/test.sh +++ b/tests/gitfs/test.sh @@ -13,7 +13,7 @@ COMMON_FILE="${SCRIPT_PATH}/../lib/common.sh" source "${COMMON_FILE}" trap cleanup EXIT -export GITFS_KEYS_DIR=${GITFS_KEYS_DIR:-tests/gitfs/data/keys/gitfs} +export GITFS_KEYS_DIR=${GITFS_KEYS_DIR:-"${SCRIPT_PATH}/data/keys/gitfs"} # Check gitfs keys are present echo "==> Checking gitfs keys are present ..." @@ -25,8 +25,8 @@ ok "gitfs keys" # Run test instance echo "==> Starting docker-salt-master (${PLATFORM}) with RSA 4096 ssh key ..." start_container_and_wait \ - --volume "$(pwd)/tests/gitfs/config":/home/salt/data/config:ro \ - --volume "$(pwd)/${GITFS_KEYS_DIR%%/gitfs}":/home/salt/data/keys \ + --volume "${SCRIPT_PATH}/config":/home/salt/data/config:ro \ + --volume "${GITFS_KEYS_DIR%%/gitfs}":/home/salt/data/keys \ || error "container started" ok "container started" diff --git a/tests/lib/common.sh b/tests/lib/common.sh index 0922eb3..01a27a2 100644 --- a/tests/lib/common.sh +++ b/tests/lib/common.sh @@ -30,7 +30,7 @@ export BOOTUP_WAIT_SECONDS=${BOOTUP_WAIT_SECONDS:-60} #---------------------------------------------------------------------------------------------------------------------- function cleanup() { - echo "==> Removing ${CONTAINER_NAME} ..." + echo "🧹 Removing ${CONTAINER_NAME} ..." docker container rm --force "${CONTAINER_NAME}" } diff --git a/tests/salt-api/test.sh b/tests/salt-api/test.sh index 5f66105..e46febe 100755 --- a/tests/salt-api/test.sh +++ b/tests/salt-api/test.sh @@ -31,7 +31,7 @@ external_auth: - '@wheel' - '@jobs' EOF -echo "salt-api config created ✅" +ok "salt-api config created" # Run test instance echo "==> Starting docker-salt-master (${PLATFORM}) with salt-api config ..."