-
Notifications
You must be signed in to change notification settings - Fork 20
soa-mname incorrectly typed as integer #117
Comments
I can confirm that it should be a serialised nameserver object, and actually it is for me: Are you using the latest version of netbox-dns (I assume you are, but there was a change a while ago that fixed exactly what you're reporting):
|
Am I correct in assuming that you are trying to import zones from PowerDNS to Netbox DNS? You need to create the NameServer object for the name server specified in
I just tried it with the following result:
Maybe this helps. I found, however, a restriction: Currently it isn't possible to populate the
[edited out obvious nonsense :-)] |
I must admit that I don't have the slightest idea from where the Netbox API documentation tool gets the information that the soa_mname should be an integer. The serializer has the right definition:
The model has it as well (wouldn't work otherwise, which always is a good indication):
At the moment I just can't figure out where that comes from. But I can assure you that it's wrong ... I'll continue to try to find it, but don't hold your breath. |
Thanks very much for going into so much detail into this issue. It's an odd one, with the API reporting this as an integer. Netbox API is running The HTML added is as so, if it helps: <tr class="property-row required"><td><!-- react-text: 13140 -->soa_mname<!-- /react-text --><span class="star">*</span></td><td><span class="model"><span class="prop"><span class="prop-type">integer</span><span class="property primitive"><br><!-- react-text: 13148 -->title<!-- /react-text --><!-- react-text: 13149 -->: <!-- /react-text --><!-- react-text: 13150 -->SOA MName<!-- /react-text --></span></span></span></td></tr> I'm trying to push the following: {
"name": "dingo.zone",
"soa_mname": {
"name": "b.dns.dingo.management"
},
"soa_rname": "admin.dingo.zone.",
"soa_ttl": 3600,
"soa_serial": 1627142029,
"soa_refresh": 10800,
"soa_retry": 3600,
"soa_expire": 604800,
"soa_minimum": 3600
} To which I keep seeing: {"soa_mname":["This field cannot be null."]} My code has worked for importing other objects into Netbox, so I'm unsure why it keeps thinking |
That nameserver is also already configured on Netbox {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"url": "http://10.84.0.2/api/plugins/netbox-dns/nameservers/1/",
"display": "a.dns.dingo.management",
"name": "a.dns.dingo.management",
"tags": [],
"created": "2021-12-21",
"last_updated": "2021-12-21T15:27:02.308147Z"
},
{
"id": 2,
"url": "http://10.84.0.2/api/plugins/netbox-dns/nameservers/2/",
"display": "b.dns.dingo.management",
"name": "b.dns.dingo.management",
"tags": [],
"created": "2021-12-21",
"last_updated": "2021-12-21T15:27:07.138644Z"
}
]
} |
Hi, could there be something wrong with your error handling code? I just tried to push the same data you used to my instance, and I also get a null value error - but not on
Could you please try adding |
Just to be on the safe side I just retried with Netbox 3.1.2 (my test environment was still on 3.1.1). Same result - with |
With these assortment of small differences (default_ttl being required, soa_mname reporting as an integer) I believe there's going to be an issue with my environment, it's the only thing I can explain this with. It's almost as of I have content from different versions merged in with each other. {'name': 'home.dingo.services', 'default_ttl': 3600, 'nameservers': [{'name': 'b.dns.dingo.management'}, {'name': 'a.dns.dingo.management'}], 'soa_mname': {'name': 'a.dns.dingo.management'}, 'soa_rname': 'admin.home.dingo.services.', 'soa_ttl': 3600, 'soa_serial': 1637495034, 'soa_refresh': 10800, 'soa_retry': 3600, 'soa_expire': 604800, 'soa_minimum': 3600}
{"soa_mname":["This field cannot be null."]} I'll continue to investigate on my end. |
Oh yeah this is definitely most likely a layer 8 problem with myself. I added a json.dumps to the API call, and then I see {
"name": "home.dingo.services",
"default_ttl": 3600,
"nameservers": [
{
"name": "a.dns.dingo.management"
},
{
"name": "b.dns.dingo.management"
}
],
"soa_mname": {
"name": "b.dns.dingo.management"
},
"soa_rname": "admin.home.dingo.services.",
"soa_ttl": 3600,
"soa_serial": 1637495034,
"soa_refresh": 10800,
"soa_retry": 3600,
"soa_expire": 604800,
"soa_minimum": 3600
}
{"detail":"Unsupported media type \"\" in request."} |
The "Unsupported media type" could be a result of a missing "Content-Type: application/json" in your request - did you include that? |
Hi @martydingo, don't try to fix the issue with the incorrect documentation of the I see the incorrect documentation as in a functioning environment as well, and it seems to have its cause somewhere in the Code that automatically generates the API documentation or in the way netbox-dns presents its interface. |
Interesting, I had put this on hold as time is not-so-spare. Happy to test any fixes. |
@martydingo: It would be great if you could try with a correct "Content-Type:" header. As far as I understand that's your real issue, while the incorrect documentation is a nuisance (I agree) but not a show-stopper. |
Okay cool, will do and will update. |
@martydingo: Did you find the time to try it again? As I said it works for me. Can you also try with |
@martydingo: I just checked some other object types in NetBox (not NetBox DNS), and the incorrect classification of object types in POST requests as integer can be found there as well. Look, for instance, at the GET request for So it seems the incorrect type in the documentation is, if any, a bug in NetBox, not NetBox DNS. @hatsat32: I suggest closing this issue as we can't do anything about it. |
Hiya there,
Currently I'm writing a python script to interpolate between the PowerDNS API and the Netbox API, while troubleshooting some API call issues, looking at the Netbox API documentation, adding zones via an API call via POST specifies the following
The MNAME should be a string, not an integer, as per the MNAME listed in https://www.cloudflare.com/en-gb/learning/dns/dns-records/dns-soa-record/
There would be no circumstances an SOA MNAME contained within the rrset returned would ever be an integer, so this type should be changed.
The text was updated successfully, but these errors were encountered: