Skip to content

Commit 2fb3914

Browse files
authored
Merge pull request #154 from tyler-8/clear_cache_command
Add tasks & checks for clearcache command
2 parents 3b50450 + 73b4026 commit 2fb3914

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tasks/deploy_netbox.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@
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+
217+
django_manage:
218+
command: "clearcache"
219+
app_path: "{{ netbox_current_path }}/netbox"
220+
virtualenv: "{{ netbox_virtualenv_path }}"
221+
when:
222+
- netbox_stable and netbox_stable_version is version('3.2.2', '>')
223+
or netbox_git and _netbox_git_contains_add_clearcache.rc == 0
216224

217225
become: true
218226
become_user: "{{ netbox_user }}"

tasks/install_via_git.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@
7878
changed_when: False
7979
failed_when: "_netbox_git_contains_invalidate_removed.rc not in [0, 1]"
8080

81+
- name: Check existence of commit b172ae6, adding the clearcache command
82+
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^b172ae65d24f6dc161c4b609477a4547bb62a50b'
83+
args:
84+
chdir: "{{ netbox_git_repo_path }}"
85+
executable: /bin/bash
86+
register: _netbox_git_contains_add_clearcache
87+
changed_when: False
88+
failed_when: "_netbox_git_contains_add_clearcache.rc not in [0, 1]"
89+
8190
- name: Archive and extract snapshot of git repository
8291
shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"'
8392
args:

0 commit comments

Comments
 (0)