netbox-plugin-dns
netbox-plugin-dns copied to clipboard
DNS Zone Webhook Returns Empty List
Versions NetBox Version: 3.6.4 NetBox DNS Version: 0.20.2 Python Version: 3.10.12
Describe the bug When creating a new zone, the webhook returns an empty list and does not display the nameservers. This is an issue because I cannot update a specific nameserver with the new zone data. I also noticed that it does not return the correct nameserver when I update the zone.
To Reproduce
- Create a webhook. Ex:
{
"id": 3,
"url": "https://netbox.infra.example.net/api/extras/webhooks/3/",
"display": "DNS Webhook",
"content_types": [
"netbox_dns.nameserver",
"netbox_dns.zone",
"netbox_dns.record",
"netbox_dns.view"
],
"name": "DNS Webhook",
"type_create": true,
"type_update": true,
"type_delete": true,
"type_job_start": false,
"type_job_end": false,
"payload_url": "http://10.30.23.69:18000",
"enabled": true,
"http_method": "POST",
"http_content_type": "application/json",
"additional_headers": "",
"body_template": "",
"secret": "",
"conditions": null,
"ssl_verification": false,
"ca_file_path": null,
"custom_fields": {},
"tags": [],
"created": "2023-11-09T20:32:14.599971Z",
"last_updated": "2023-11-09T20:35:08.783193Z"
}
- I used
nc -l 18000
on my local machine to listen to all requests coming from the webhook. - Create two nameservers,
ns1.example.com
andns2.example.com
- Create a zone,
example.com
withns1.example.com
andns2.example.com
selected in the WebUI as the nameservers. - The json result does not show any nameservers:
{
"event": "created",
"timestamp": "2023-11-09 20:46:15.821455+00:00",
"model": "zone",
"username": "ben",
"request_id": "61039297-0d40-486e-893a-040a21493d60",
"data": {
"id": 11,
"url": "/api/plugins/netbox-dns/zones/11/",
"name": "example.com",
"view": {
"id": 1,
"url": "/api/plugins/netbox-dns/views/1/",
"display": "Internal",
"name": "Internal"
},
"display": "[Internal] example.com",
"nameservers": [],
"status": "active",
"description": "test zone",
"tags": [],
"created": "2023-11-09T20:46:15.692991Z",
"last_updated": "2023-11-09T20:46:15.693009Z",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": {
"id": 4,
"url": "/api/plugins/netbox-dns/nameservers/4/",
"display": "ns1.example.com",
"name": "ns1.example.com"
},
"soa_rname": "admin.example.com",
"soa_serial": 1699562776,
"soa_serial_auto": true,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"active": null,
"custom_fields": {},
"tenant": null
},
"snapshots": {
"prechange": null,
"postchange": {
"created": "2023-11-09T20:46:15.692Z",
"last_updated": "2023-11-09T20:46:15.693Z",
"view": 1,
"name": "example.com",
"status": "active",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": 4,
"soa_rname": "admin.example.com",
"soa_serial": 1699562776,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"soa_serial_auto": true,
"description": "test zone",
"arpa_network": null,
"tenant": null,
"nameservers": [],
"custom_fields": {},
"tags": []
}
}
}
- I deleted
ns2.example.com
from the zone in the webUI, but the update then returned both Nameservers:
{
"event": "updated",
"timestamp": "2023-11-09 20:55:56.702573+00:00",
"model": "zone",
"username": "ben",
"request_id": "bd59306d-1c19-465d-abba-edc5ee433ec7",
"data": {
"id": 11,
"url": "/api/plugins/netbox-dns/zones/11/",
"name": "example.com",
"view": {
"id": 1,
"url": "/api/plugins/netbox-dns/views/1/",
"display": "Internal",
"name": "Internal"
},
"display": "[Internal] example.com",
"nameservers": [
{
"id": 4,
"url": "/api/plugins/netbox-dns/nameservers/4/",
"display": "ns1.example.com",
"name": "ns1.example.com"
},
{
"id": 5,
"url": "/api/plugins/netbox-dns/nameservers/5/",
"display": "ns2.example.com",
"name": "ns2.example.com"
}
],
"status": "active",
"description": "test zone",
"tags": [],
"created": "2023-11-09T20:46:15.692991Z",
"last_updated": "2023-11-09T20:55:56.602596Z",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": {
"id": 4,
"url": "/api/plugins/netbox-dns/nameservers/4/",
"display": "ns1.example.com",
"name": "ns1.example.com"
},
"soa_rname": "admin.example.com",
"soa_serial": 1699562776,
"soa_serial_auto": true,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"active": true,
"custom_fields": {},
"tenant": null
},
"snapshots": {
"prechange": {
"created": "2023-11-09T20:46:15.692Z",
"last_updated": "2023-11-09T20:46:15.787Z",
"view": 1,
"name": "example.com",
"status": "active",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": 4,
"soa_rname": "admin.example.com",
"soa_serial": 1699562776,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"soa_serial_auto": true,
"description": "test zone",
"arpa_network": null,
"tenant": null,
"nameservers": [
4,
5
],
"custom_fields": {},
"tags": []
},
"postchange": {
"created": "2023-11-09T20:46:15.692Z",
"last_updated": "2023-11-09T20:55:56.602Z",
"view": 1,
"name": "example.com",
"status": "active",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": 4,
"soa_rname": "admin.example.com",
"soa_serial": 1699562776,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"soa_serial_auto": true,
"description": "test zone",
"arpa_network": null,
"tenant": null,
"nameservers": [
4,
5
],
"custom_fields": {},
"tags": []
}
}
}
- I readded
ns2.example.com
to the zone, and it only showedns1.example.com
:
{
"event": "updated",
"timestamp": "2023-11-09 20:56:06.296369+00:00",
"model": "zone",
"username": "ben",
"request_id": "dc454d86-731b-4be2-b59a-b4388679528d",
"data": {
"id": 11,
"url": "/api/plugins/netbox-dns/zones/11/",
"name": "example.com",
"view": {
"id": 1,
"url": "/api/plugins/netbox-dns/views/1/",
"display": "Internal",
"name": "Internal"
},
"display": "[Internal] example.com",
"nameservers": [
{
"id": 4,
"url": "/api/plugins/netbox-dns/nameservers/4/",
"display": "ns1.example.com",
"name": "ns1.example.com"
}
],
"status": "active",
"description": "test zone",
"tags": [],
"created": "2023-11-09T20:46:15.692991Z",
"last_updated": "2023-11-09T20:56:06.175544Z",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": {
"id": 4,
"url": "/api/plugins/netbox-dns/nameservers/4/",
"display": "ns1.example.com",
"name": "ns1.example.com"
},
"soa_rname": "admin.example.com",
"soa_serial": 1699563357,
"soa_serial_auto": true,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"active": true,
"custom_fields": {},
"tenant": null
},
"snapshots": {
"prechange": {
"created": "2023-11-09T20:46:15.692Z",
"last_updated": "2023-11-09T20:55:56.666Z",
"view": 1,
"name": "example.com",
"status": "active",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": 4,
"soa_rname": "admin.example.com",
"soa_serial": 1699563357,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"soa_serial_auto": true,
"description": "test zone",
"arpa_network": null,
"tenant": null,
"nameservers": [
4
],
"custom_fields": {},
"tags": []
},
"postchange": {
"created": "2023-11-09T20:46:15.692Z",
"last_updated": "2023-11-09T20:56:06.175Z",
"view": 1,
"name": "example.com",
"status": "active",
"default_ttl": 86400,
"soa_ttl": 86400,
"soa_mname": 4,
"soa_rname": "admin.example.com",
"soa_serial": 1699563357,
"soa_refresh": 172800,
"soa_retry": 7200,
"soa_expire": 2592000,
"soa_minimum": 3600,
"soa_serial_auto": true,
"description": "test zone",
"arpa_network": null,
"tenant": null,
"nameservers": [
4
],
"custom_fields": {},
"tags": []
}
}
}