From af712839c84e484e70aa5e7d854b8fcbb5aa2e06 Mon Sep 17 00:00:00 2001 From: "Simon Leinen (SWITCH)" Date: Tue, 30 Jan 2024 17:03:15 +0100 Subject: [PATCH 1/2] Fix check for clearcache removal in the Git case --- tasks/deploy_netbox.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/deploy_netbox.yml b/tasks/deploy_netbox.yml index 874fbab..3c95501 100644 --- a/tasks/deploy_netbox.yml +++ b/tasks/deploy_netbox.yml @@ -221,8 +221,8 @@ when: - netbox_stable and netbox_stable_version is version('3.2.2', '>') and netbox_stable_version is version('3.7.0', '<') - or netbox_git and _netbox_git_contains_add_clearcache.rc == 0 - and _netbox_git_contains_remove_clearcache != 0 + or netbox_git and ( _netbox_git_contains_add_clearcache.rc == 0 + and _netbox_git_contains_remove_clearcache.rc != 0 ) become: true become_user: "{{ netbox_user }}" From e00faa5c468981f2c4fdb79ce314beb12adbfe10 Mon Sep 17 00:00:00 2001 From: "Simon Leinen (SWITCH)" Date: Tue, 30 Jan 2024 17:03:34 +0100 Subject: [PATCH 2/2] Run check for clearcache removal commit under "become" ...like the other checks. --- tasks/install_via_git.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tasks/install_via_git.yml b/tasks/install_via_git.yml index 91cc682..a1a0615 100644 --- a/tasks/install_via_git.yml +++ b/tasks/install_via_git.yml @@ -89,18 +89,18 @@ changed_when: False failed_when: "_netbox_git_contains_add_clearcache.rc not in [0, 1]" + - name: Check existence of commit 2d1f882, removing the clearcache command + shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^2d1f88272497ca72d2e1eca8e291c04538c6810e' + args: + chdir: "{{ netbox_git_repo_path }}" + executable: /bin/bash + register: _netbox_git_contains_remove_clearcache + changed_when: False + failed_when: "_netbox_git_contains_remove_clearcache.rc not in [0, 1]" + become: true become_user: "{{ netbox_user }}" -- name: Check existence of commit 2d1f882, removing the clearcache command - shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^2d1f88272497ca72d2e1eca8e291c04538c6810e' - args: - chdir: "{{ netbox_git_repo_path }}" - executable: /bin/bash - register: _netbox_git_contains_remove_clearcache - changed_when: False - failed_when: "_netbox_git_contains_remove_clearcache.rc not in [0, 1]" - - name: Archive and extract snapshot of git repository shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"' args: