Stop vault on exit in gen_openapi.sh (#19252)
This commit is contained in:
parent
dd3356752a
commit
76d8d2b88a
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
openapi: Consistently stop Vault server on exit in gen_openapi.sh
|
||||||
|
```
|
|
@ -24,6 +24,14 @@ vault server -dev -dev-root-token-id=root &
|
||||||
sleep 2
|
sleep 2
|
||||||
VAULT_PID=$!
|
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
|
export VAULT_ADDR=http://127.0.0.1:8200
|
||||||
|
|
||||||
echo "Mounting all builtin plugins..."
|
echo "Mounting all builtin plugins..."
|
||||||
|
@ -125,8 +133,6 @@ else
|
||||||
'http://127.0.0.1:8200/v1/sys/internal/specs/openapi' > openapi.json
|
'http://127.0.0.1:8200/v1/sys/internal/specs/openapi' > openapi.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill $VAULT_PID
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "openapi.json generated"
|
echo "openapi.json generated"
|
||||||
|
echo
|
||||||
|
|
Loading…
Reference in New Issue