fix: make vault k8s auth script posix
This commit is contained in:
parent
5a9ceeab24
commit
cb5796cb71
@ -4,17 +4,17 @@ set -eu
|
||||
log() { echo "[vault-k8s-auth] $*"; }
|
||||
|
||||
status_json="$(vault status -format=json || true)"
|
||||
if [[ -z "${status_json}" ]]; then
|
||||
if [ -z "${status_json}" ]; then
|
||||
log "vault status failed; check VAULT_ADDR and VAULT_TOKEN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -q '"initialized":true' <<<"${status_json}"; then
|
||||
if ! printf '%s' "${status_json}" | grep -q '"initialized":true'; then
|
||||
log "vault not initialized; skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if grep -q '"sealed":true' <<<"${status_json}"; then
|
||||
if printf '%s' "${status_json}" | grep -q '"sealed":true'; then
|
||||
log "vault sealed; skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user