From 3e19038e069b385a842107bf6a4d00fa38d0d6b8 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 7 Jul 2021 21:17:40 -0400 Subject: [PATCH] Restore CACHING_REDIS_SKIP_TLS_VERIFY; add CACHE_TIMEOUT usage warning --- docs/release-notes/version-3.0.md | 1 + netbox/netbox/settings.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 6f54448ca..db9aa1b82 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -7,6 +7,7 @@ * The default CSV export format for all objects now includes all available data. Additionally, the CSV headers now use human-friendly titles rather than the raw field names. * Support for queryset caching configuration (`caching_config`) has been removed from the plugins API (see [#6639](https://github.com/netbox-community/netbox/issues/6639)). * The `cacheops_*` metrics have been removed from the Prometheus exporter (see [#6639](https://github.com/netbox-community/netbox/issues/6639)). +* The `invalidate` management command has been removed. ### New Features diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 22344938e..2ba1a047a 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -45,6 +45,10 @@ except ModuleNotFoundError as e: ) raise +# Warn on removed config parameters +if hasattr(configuration, 'CACHE_TIMEOUT'): + warnings.warn("The CACHE_TIMEOUT configuration parameter was removed in v3.0.0 and no longer has any effect.") + # Enforce required configuration parameters for parameter in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY', 'REDIS']: if not hasattr(configuration, parameter): @@ -231,8 +235,7 @@ CACHING_REDIS_PASSWORD = REDIS['caching'].get('PASSWORD', '') CACHING_REDIS_SENTINELS = REDIS['caching'].get('SENTINELS', []) CACHING_REDIS_SENTINEL_SERVICE = REDIS['caching'].get('SENTINEL_SERVICE', 'default') CACHING_REDIS_PROTO = 'rediss' if REDIS['caching'].get('SSL', False) else 'redis' -# Unused? -# CACHING_REDIS_SKIP_TLS_VERIFY = REDIS['caching'].get('INSECURE_SKIP_TLS_VERIFY', False) +CACHING_REDIS_SKIP_TLS_VERIFY = REDIS['caching'].get('INSECURE_SKIP_TLS_VERIFY', False) CACHES = { 'default': { @@ -248,6 +251,8 @@ if CACHING_REDIS_SENTINELS: CACHES['default']['LOCATION'] = f'{CACHING_REDIS_PROTO}://{CACHING_REDIS_SENTINEL_SERVICE}/{CACHING_REDIS_DATABASE}' CACHES['default']['OPTIONS']['CLIENT_CLASS'] = 'django_redis.client.SentinelClient' CACHES['default']['OPTIONS']['SENTINELS'] = CACHING_REDIS_SENTINELS +if CACHING_REDIS_SKIP_TLS_VERIFY: + CACHES['default']['OPTIONS']['CONNECTION_POOL_KWARGS']['ssl_cert_reqs'] = False #