Skip to content

Commit 7812f03

Browse files
authored
Merge pull request #186 from tyler-8/add_reindex_command
add reindex command for 3.4.5+
2 parents 69e575f + 9d7d359 commit 7812f03

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tasks/deploy_netbox.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,14 @@
242242
or netbox_git and ( _netbox_git_contains_add_clearcache.rc == 0
243243
and _netbox_git_contains_remove_clearcache.rc != 0 )
244244

245+
- name: Rebuild the search cache (lazily)
246+
django_manage:
247+
command: "reindex --lazy"
248+
app_path: "{{ netbox_current_path }}/netbox"
249+
virtualenv: "{{ netbox_virtualenv_path }}"
250+
when:
251+
- netbox_stable and netbox_stable_version is version('3.4.4', '>')
252+
or netbox_git and _netbox_git_contains_reindex_lazy.rc == 0
253+
245254
become: true
246255
become_user: "{{ netbox_user }}"

tasks/install_via_git.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@
9898
changed_when: False
9999
failed_when: "_netbox_git_contains_remove_clearcache.rc not in [0, 1]"
100100

101+
- name: Check existence of commit 5a4d8a7, adding the reindex lazy command
102+
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^5a4d8a71075a4529be8d5ef22d76d69861240f45'
103+
args:
104+
chdir: "{{ netbox_git_repo_path }}"
105+
executable: /bin/bash
106+
register: _netbox_git_contains_reindex_lazy
107+
changed_when: False
108+
failed_when: "_netbox_git_contains_reindex_lazy.rc not in [0, 1]"
109+
101110
become: true
102111
become_user: "{{ netbox_user }}"
103112

0 commit comments

Comments
 (0)