Fix: Do not exit 1, just don't provide credentials on get

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-11 14:20:14 +02:00
parent 71d5db1c0a
commit 38ab36dded
Signed by: luzifer
GPG Key ID: D91C3E91E4CAD6F5

View File

@ -19,7 +19,7 @@ set -euo pipefail
config="${HOME}/.config/docker-credential-vault"
req_cmds=(jq md5sum vault)
NO_LOG=1
: ${NO_LOG:=1}
PREFIX=secret/docker-credential
[[ -f $config ]] && source "${config}" || true
@ -35,7 +35,7 @@ function get() {
local hostname="$(cat -s)" # Missing newline at the end, read does not work
log "Retrieving credential for ${hostname} if exists..."
vault read -field=data -format=json "${PREFIX}/$(hash_hostname "${hostname}")"
vault read -field=data -format=json "${PREFIX}/$(hash_hostname "${hostname}")" 2>/dev/null || echo "{}"
}
function erase() {