Stop vault on exit in gen_openapi.sh (#19252)

This commit is contained in:
Anton Averchenkov 2023-02-17 13:06:00 -05:00 committed by GitHub
parent dd3356752a
commit 76d8d2b88a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

3
changelog/19252.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
openapi: Consistently stop Vault server on exit in gen_openapi.sh
```

View File

@ -24,6 +24,14 @@ vault server -dev -dev-root-token-id=root &
sleep 2
VAULT_PID=$!
defer_stop_vault() {
echo "Stopping Vault..."
kill $VAULT_PID
sleep 1
}
trap defer_stop_vault INT TERM EXIT
export VAULT_ADDR=http://127.0.0.1:8200
echo "Mounting all builtin plugins..."
@ -125,8 +133,6 @@ else
'http://127.0.0.1:8200/v1/sys/internal/specs/openapi' > openapi.json
fi
kill $VAULT_PID
sleep 1
echo
echo "openapi.json generated"
echo