Merge pull request 'fix(vault-fetch): tolerate 'already logged in' at bw config server' (#68) from fix/vault-fetch-bw-config-when-logged-in into main
Reviewed-on: #68
This commit is contained in:
commit
14bd7f5255
1 changed files with 11 additions and 4 deletions
|
|
@ -105,10 +105,17 @@ cleanup() {
|
|||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
bw config server "$SERVER" >/dev/null 2>&1 || {
|
||||
log "could not set bw server to $SERVER"
|
||||
exit 1
|
||||
}
|
||||
# Set the server. When already logged in, `bw config` refuses with
|
||||
# "Logout required before server config update" — tolerate that, since the
|
||||
# server is already set to the right value (we read it from VAULT_SERVER).
|
||||
# Mirror the login tolerance: capture stderr and only fail on a real error.
|
||||
if ! bw config server "$SERVER" >"$WORK/config.out" 2>"$WORK/config.err"; then
|
||||
if ! grep -qi 'logout required\|already configured\|already set' "$WORK/config.err" "$WORK/config.out" 2>/dev/null; then
|
||||
log "could not set bw server to $SERVER:"
|
||||
sed 's/^/ /' "$WORK/config.err" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# login --apikey reads BW_CLIENTID/BW_CLIENTSECRET from env. Tolerate the
|
||||
# "already logged in" case so repeat runs don't fail.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue