Skip to content

Commit a278b09

Browse files
committed
Compatibility with Netbox 3.7
netbox-community/netbox@2d1f882 removed the 'clearcache' command
1 parent 5999de7 commit a278b09

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

tasks/deploy_netbox.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
app_path: "{{ netbox_current_path }}/netbox"
205205
virtualenv: "{{ netbox_virtualenv_path }}"
206206

207-
- name: Clear cached data in NetBox
207+
- name: Clear cached data in NetBox < 3
208208
django_manage:
209209
command: "invalidate all"
210210
app_path: "{{ netbox_current_path }}/netbox"
@@ -213,14 +213,16 @@
213213
- netbox_stable and netbox_stable_version is version('3.0.0', '<')
214214
or netbox_git and _netbox_git_contains_invalidate_removed.rc != 0
215215

216-
- name: Clear cached data in NetBox 3.2.3+
216+
- name: Clear cached data in NetBox 3.2.3 to 3.6
217217
django_manage:
218218
command: "clearcache"
219219
app_path: "{{ netbox_current_path }}/netbox"
220220
virtualenv: "{{ netbox_virtualenv_path }}"
221221
when:
222222
- netbox_stable and netbox_stable_version is version('3.2.2', '>')
223-
or netbox_git and _netbox_git_contains_add_clearcache.rc == 0
223+
and netbox_stable_version is version('3.7.0', '<')
224+
or netbox_git and _netbox_git_contains_add_clearcache.rc == 0
225+
and _netbox_git_contains_remove_clearcache != 0
224226

225227
become: true
226228
become_user: "{{ netbox_user }}"

tasks/install_via_git.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@
8787
changed_when: False
8888
failed_when: "_netbox_git_contains_add_clearcache.rc not in [0, 1]"
8989

90+
- name: Check existence of commit 2d1f882, removing the clearcache command
91+
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^2d1f88272497ca72d2e1eca8e291c04538c6810e'
92+
args:
93+
chdir: "{{ netbox_git_repo_path }}"
94+
executable: /bin/bash
95+
register: _netbox_git_contains_remove_clearcache
96+
changed_when: False
97+
failed_when: "_netbox_git_contains_remove_clearcache.rc not in [0, 1]"
98+
9099
- name: Archive and extract snapshot of git repository
91100
shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"'
92101
args:

0 commit comments

Comments
 (0)