From f88b36fd1eb091fcf3338213f4769201ca020b1e Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 5 Jul 2020 21:12:10 +0200 Subject: [PATCH] git_auto_update: Added and used error function --- roles/git_auto_update/templates/update.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/git_auto_update/templates/update.sh b/roles/git_auto_update/templates/update.sh index 9f9e7c6..5140969 100644 --- a/roles/git_auto_update/templates/update.sh +++ b/roles/git_auto_update/templates/update.sh @@ -9,6 +9,10 @@ readonly DEST_GROUP={{ group | quote }}; readonly PREFIX={{ tag_prefix | quote }}; readonly GPG_FINGERPRINT={{ gpg_fingerprint | quote }}; +function error() { + echo "$@" >&2; +} + cd "$DEST"; if [ ! -d .git ]; then @@ -26,10 +30,10 @@ if [ -z "$GPG_FINGERPRINT" ] || (git verify-tag --raw "$TAG" 2>&1 | grep --fixed git checkout --quiet --recurse-submodules "$TAG"; chown --recursive "$DEST_USER:$DEST_GROUP" .; if ! sh -c {{ reload_command | default('true') | quote }}; then - echo "Reload command failed" >&2; + error "Reload command failed"; exit 2; fi else - echo "Invalid or missing signature for $TAG" >&2; + error "Invalid or missing signature for $TAG"; exit 1; fi