crowdsec/test/instance-data
mmetc ace942a36d
tests: prevent "make bats-fixture" to run if instance-data is locked (#3201)
* tests: prevent "make bats-fixture" to run if instance-data is locked

* lint
2024-09-06 10:31:00 +02:00

26 lines
617 B
Bash
Executable file

#!/usr/bin/env bash
set -eu
die() {
echo >&2 "$@"
exit 1
}
#shellcheck disable=SC1007
THIS_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd "$THIS_DIR" || exit 1
# shellcheck disable=SC1091
. ./.environment.sh
if [[ -f "$LOCAL_INIT_DIR/.lock" ]] && [[ "$1" != "unlock" ]]; then
die "init data is locked: are you doing some manual test? if so, please finish what you are doing, run 'instance-data unlock' and retry"
fi
backend_script="./lib/config/config-${CONFIG_BACKEND}"
if [[ ! -x "$backend_script" ]]; then
die "unknown config backend '${CONFIG_BACKEND}'"
fi
exec "$backend_script" "$@"