Add configurable catalog zone naming
- New setting 'catalog_zone_name' (default: 'catz') to change the name of the per-view catalog zone. Full DNS names (multiple labels) are supported; names are handled as dns.name.Name objects, making the comparison case-insensitive and tolerant of trailing dots. - New setting 'catalog_zone_name_includes_view' (default: False). When enabled, the catalog zone name is prefixed with the view name: '<view>.<catalog_zone_name>'. - The transfer endpoint now serves exactly the one configured catalog zone name per view instead of accepting both 'catz' and '<view>.catz'. - The catalog zone NOTIFY now targets only the configured name instead of notifying for both variants. Scheduling moved to catalog_zone_manager, which owns all catalog zone naming.
This commit is contained in:
1 parent
5c673d9903
commit
fe24dbdd98
5 files changed
+89
-48
No files matched your search
@@ -12,7 +12,7 @@ from django.db import close_old_connections, OperationalError
|
||||
from netbox.jobs import JobRunner
|
||||
from netbox_dns.models import View, Zone, Record
|
||||
from netbox_dns_bridge.utils import get_logger
|
||||
from netbox_dns_bridge.models import SeenTransferClient, CatalogZone
|
||||
from netbox_dns_bridge.models import SeenTransferClient
|
||||
|
||||
LOGGER = get_logger(__name__)
|
||||
SETTINGS = settings.PLUGINS_CONFIG.get("netbox_dns_bridge", {})
|
||||
@@ -281,38 +281,3 @@ def schedule_ns_notify(zone: Zone):
|
||||
view_name=zone.view.name,
|
||||
soa_serial=soa_serial,
|
||||
)
|
||||
|
||||
|
||||
def schedule_catalog_zone_notify(view: View):
|
||||
if not SETTINGS.get("notify_clients", False):
|
||||
return
|
||||
|
||||
try:
|
||||
catalog_zone = view.catalog_zone
|
||||
except CatalogZone.DoesNotExist:
|
||||
return
|
||||
|
||||
serial = catalog_zone.soa_serial
|
||||
soa_refresh = catalog_zone.soa_refresh
|
||||
soa_retry = catalog_zone.soa_retry
|
||||
soa_expire = catalog_zone.soa_expire
|
||||
soa_minimum = catalog_zone.soa_minimum
|
||||
|
||||
SendClientNotify.enqueue(
|
||||
zone_name="catz",
|
||||
soa_serial=serial,
|
||||
view_name=view.name,
|
||||
soa_refresh=soa_refresh,
|
||||
soa_retry=soa_retry,
|
||||
soa_expire=soa_expire,
|
||||
soa_minimum=soa_minimum,
|
||||
)
|
||||
SendClientNotify.enqueue(
|
||||
zone_name=f"{view.name}.catz",
|
||||
soa_serial=serial,
|
||||
view_name=view.name,
|
||||
soa_refresh=soa_refresh,
|
||||
soa_retry=soa_retry,
|
||||
soa_expire=soa_expire,
|
||||
soa_minimum=soa_minimum,
|
||||
)
|
||||
Reference in new issue
Block a user