From d570f3cdb3948670e409345cd52131e2c3e59b50 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Fri, 16 Aug 2019 04:44:43 +0200 Subject: [PATCH] git_auto_update: Allow reload_command failing during playbook execution --- roles/git_auto_update/tasks/main.yml | 2 ++ roles/git_auto_update/templates/update.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/git_auto_update/tasks/main.yml b/roles/git_auto_update/tasks/main.yml index 5465674..1b2184b 100644 --- a/roles/git_auto_update/tasks/main.yml +++ b/roles/git_auto_update/tasks/main.yml @@ -20,6 +20,8 @@ command: "{{ update_script_path }}" args: creates: "{{ dest }}/.git" + register: update_result + failed_when: update_result.rc not in [0, 2] - name: Enable auto update of {{ repo_name }} cron: diff --git a/roles/git_auto_update/templates/update.sh b/roles/git_auto_update/templates/update.sh index 8dac868..29f2a0d 100644 --- a/roles/git_auto_update/templates/update.sh +++ b/roles/git_auto_update/templates/update.sh @@ -22,7 +22,10 @@ TAG=$(git tag --list | grep "^$PREFIX" | sort -r | head -n 1); if git verify-tag --raw "$TAG" 2>&1 | grep " VALIDSIG $GPG_FINGERPRINT " > /dev/null; then git checkout -q "$TAG"; chown -R "$DEST_USER:$DEST_GROUP" .; - {{ reload_command | default('') }} + if sh -c {{ reload_command | default('') | quote }}; then + echo "Failed during reload" >&2; + exit 2; + fi else echo "Invalid or missing signature for $TAG" >&2; exit 1;