From 65eca5090b4bfd1ed1223fb7e2327ca8ed9be866 Mon Sep 17 00:00:00 2001 From: Musee Ullah Date: Mon, 4 May 2020 14:13:42 -0500 Subject: [PATCH] Rename webhooks Redis connection to tasks Fixes #86 --- tasks/install_via_git.yml | 9 +++++++++ templates/configuration.py.j2 | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tasks/install_via_git.yml b/tasks/install_via_git.yml index cf32a41..7765934 100644 --- a/tasks/install_via_git.yml +++ b/tasks/install_via_git.yml @@ -24,6 +24,15 @@ changed_when: False failed_when: "_netbox_git_contains_issue_2239_fix.rc not in [0, 1]" +- name: Check existence of commit 3590ed3, renaming webhooks to tasks + shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^3590ed378d161dd724fad2dc73ff56da746352f8' + args: + chdir: "{{ netbox_git_repo_path }}" + executable: /bin/bash + register: _netbox_git_contains_tasks_rename + changed_when: False + failed_when: "_netbox_git_contains_tasks_rename.rc not in [0, 1]" + - name: Archive and extract snapshot of git repository shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"' args: diff --git a/templates/configuration.py.j2 b/templates/configuration.py.j2 index b980ae2..5ef55f5 100644 --- a/templates/configuration.py.j2 +++ b/templates/configuration.py.j2 @@ -1,6 +1,6 @@ +{{ ansible_managed | comment }} import json import os -{{ ansible_managed | comment }} {% if netbox_metrics_enabled %} if "prometheus_multiproc_dir" in os.environ: @@ -30,7 +30,13 @@ DATABASE = { } REDIS = { +{# https://github.com/netbox-community/netbox/pull/4366 #} +{% if netbox_stable and netbox_stable_version is version('2.7.11', '>=') or + netbox_git and _netbox_git_contains_tasks_rename %} + 'tasks': { +{% else %} 'webhooks': { +{% endif %} 'HOST': '{{ netbox_redis_host }}', 'PORT': {{ netbox_redis_port }}, 'PASSWORD': '{{ netbox_redis_password }}',