wait longer before importing realms for new keycloak w/ burnettk

This commit is contained in:
jasquat 2022-10-24 15:47:48 -04:00
parent 945b3c0d72
commit ac31f4bff9
1 changed files with 19 additions and 3 deletions

View File

@ -1,10 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function setup_traps() {
trap 'error_handler ${LINENO} $?' ERR
}
function remove_traps() {
trap - ERR
}
function error_handler() { function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}." >&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2" exit "$2"
} }
trap 'error_handler ${LINENO} $?' ERR setup_traps
set -o errtrace -o errexit -o nounset -o pipefail set -o errtrace -o errexit -o nounset -o pipefail
if ! docker network inspect spiffworkflow > /dev/null 2>&1; then if ! docker network inspect spiffworkflow > /dev/null 2>&1; then
@ -25,8 +33,16 @@ docker run \
docker cp bin/spiffworkflow-realm.json keycloak:/tmp docker cp bin/spiffworkflow-realm.json keycloak:/tmp
sleep 10 sleep 20
docker exec keycloak /opt/keycloak/bin/kc.sh import --file /tmp/spiffworkflow-realm.json || echo '' remove_traps
set +e
import_output=$(docker exec keycloak /opt/keycloak/bin/kc.sh import --file /tmp/spiffworkflow-realm.json 2>&1)
setup_traps
set -e
if ! grep -qE "Import finished successfully" <<<"$import_output"; then
echo -e "FAILED: $import_output"
exit 1
fi
echo 'imported realms' echo 'imported realms'