Skip to content

Commit 192137b

Browse files
committed
Perform version check for Netbox 2.9.4 for RQ_DEFAULT_TIMEOUT
1 parent 4325b1e commit 192137b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

tasks/install_via_git.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
changed_when: False
3434
failed_when: "_netbox_git_contains_tasks_rename.rc not in [0, 1]"
3535

36+
- name: Check existence of commit 90dbe9b, renaming DEFAULT_TIMEOUT to RQ_DEFAULT_TIMEOUT
37+
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^90dbe9bf60ab3c72be10fd070c65c26dca543ca5'
38+
args:
39+
chdir: "{{ netbox_git_repo_path }}"
40+
executable: /bin/bash
41+
register: _netbox_git_contains_rq_timeout
42+
changed_when: False
43+
failed_when: "_netbox_git_contains_rq_timeout.rc not in [0, 1]"
44+
3645
- name: Archive and extract snapshot of git repository
3746
shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"'
3847
args:

templates/configuration.py.j2

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ DATABASE = {
3030
'CONN_MAX_AGE': {{ netbox_database_conn_age }},
3131
}
3232

33+
{% if netbox_stable and netbox_stable_version is version('2.9.4', '>=') or
34+
netbox_git and _netbox_git_contains_rq_timeout.rc == 0 %}
35+
{% set _default_timeout = "RQ_DEFAULT_TIMEOUT" %}
36+
{% else %}
37+
{% set _default_timeout = "DEFAULT_TIMEOUT" %}
38+
{% endif %}
39+
3340
REDIS = {
3441
{# https://github.com/netbox-community/netbox/pull/4366 #}
3542
{% if netbox_stable and netbox_stable_version is version('2.7.11', '>=') or
@@ -42,15 +49,15 @@ REDIS = {
4249
'PORT': {{ netbox_redis_port }},
4350
'PASSWORD': '{{ netbox_redis_password }}',
4451
'DATABASE': {{ netbox_redis_database }},
45-
'RQ_DEFAULT_TIMEOUT': {{ netbox_redis_default_timeout }},
52+
'{{ _default_timeout }}': {{ netbox_redis_default_timeout }},
4653
'SSL': {{ netbox_redis_ssl_enabled }},
4754
},
4855
'caching': {
4956
'HOST': '{{ netbox_redis_cache_host }}',
5057
'PORT': {{ netbox_redis_cache_port }},
5158
'PASSWORD': '{{ netbox_redis_cache_password }}',
5259
'DATABASE': {{ netbox_redis_cache_database }},
53-
'RQ_DEFAULT_TIMEOUT': {{ netbox_redis_cache_default_timeout }},
60+
'{{ _default_timeout }}': {{ netbox_redis_default_timeout }},
5461
'SSL': {{ netbox_redis_cache_ssl_enabled }},
5562
}
5663
}

0 commit comments

Comments
 (0)