mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge pull request #4169 from dstarner/redis-sentinel-conn-check
[Corollary to #4161] Redis Connection Check when Using Sentinel
This commit is contained in:
@ -8,21 +8,4 @@ class ExtrasConfig(AppConfig):
|
|||||||
name = "extras"
|
name = "extras"
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
|
|
||||||
import extras.signals
|
import extras.signals
|
||||||
|
|
||||||
# Check that we can connect to the configured Redis database.
|
|
||||||
try:
|
|
||||||
rs = redis.Redis(
|
|
||||||
host=settings.WEBHOOKS_REDIS_HOST,
|
|
||||||
port=settings.WEBHOOKS_REDIS_PORT,
|
|
||||||
db=settings.WEBHOOKS_REDIS_DATABASE,
|
|
||||||
password=settings.WEBHOOKS_REDIS_PASSWORD or None,
|
|
||||||
ssl=settings.WEBHOOKS_REDIS_SSL,
|
|
||||||
)
|
|
||||||
rs.ping()
|
|
||||||
except redis.exceptions.ConnectionError:
|
|
||||||
raise ImproperlyConfigured(
|
|
||||||
"Unable to connect to the Redis database. Check that the Redis configuration has been defined in "
|
|
||||||
"configuration.py."
|
|
||||||
)
|
|
||||||
|
Reference in New Issue
Block a user