Implements #81 - webhook event backend (#1640)

* merge branch develop

* bugfix, signals for virtualization's class wasn't correctly defined

* updated webhooks for 2.4 and cleanup

* updated docs to cover changes to supervisor config

* review changes and further cleanup

* updated redis connection settings

* cleanup settings
This commit is contained in:
John Anderson
2018-05-30 11:19:10 -04:00
committed by Jeremy Stretch
parent 4fd52d46bf
commit 836478c166
29 changed files with 782 additions and 3 deletions

29
netbox/extras/apps.py Normal file
View File

@@ -0,0 +1,29 @@
from __future__ import unicode_literals
from django.apps import AppConfig
from django.core.cache import caches
from django.db.utils import ProgrammingError
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
class ExtrasConfig(AppConfig):
name = "extras"
def ready(self):
import extras.signals
# check that we can connect to redis
if settings.WEBHOOK_BACKEND_ENABLED:
try:
import redis
rs = redis.Redis(settings.REDIS_HOST,
settings.REDIS_PORT,
settings.REDIS_DB,
settings.REDIS_PASSWORD or None)
rs.ping()
except redis.exceptions.ConnectionError:
raise ImproperlyConfigured(
"Unable to connect to the redis database. You must provide "
"connection settings to redis per the documentation."
)