Skip to content

Commit

Permalink
add reindex command for 3.4.5+
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-8 committed Jun 25, 2024
1 parent 69e575f commit cb0270b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tasks/deploy_netbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,14 @@
or netbox_git and ( _netbox_git_contains_add_clearcache.rc == 0
and _netbox_git_contains_remove_clearcache.rc != 0 )

- name: Rebuild the search cache (lazily)
django_manage:
command: "reindex --lazy"
app_path: "{{ netbox_current_path }}/netbox"
virtualenv: "{{ netbox_virtualenv_path }}"
when:
- netbox_stable and netbox_stable_version is version('3.4.5', '>')
or netbox_git and _netbox_git_contains_reindex_lazy.rc == 0

become: true
become_user: "{{ netbox_user }}"
9 changes: 9 additions & 0 deletions tasks/install_via_git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@
changed_when: False
failed_when: "_netbox_git_contains_remove_clearcache.rc not in [0, 1]"

- name: Check existence of commit 5a4d8a7, adding the reindex lazy command
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^5a4d8a71075a4529be8d5ef22d76d69861240f45'
args:
chdir: "{{ netbox_git_repo_path }}"
executable: /bin/bash
register: _netbox_git_contains_reindex_lazy
changed_when: False
failed_when: "_netbox_git_contains_reindex_lazy.rc not in [0, 1]"

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

Expand Down

0 comments on commit cb0270b

Please sign in to comment.