Open netravnen opened 2 hours ago
Looked around in the code-base. Was unable to locate the function/code-block needed to be edited to require the view
field in the bulk importer.
It's not really necessary ...
We can apply the following logic:
I did that recently for a different (as of yet non-public) plugin.
Requiring view generally ist clumsy as it enforces using it for importing even if the environment does not have any non-default views.
- Zone names are unique -> no view needed.
I did try that. Even if the zone-name is unique (within my installation). The bulk (CSV) importer will fail the import task with error "no object found
Another example I tried.
zone,name,type,value
zt,test1,CNAME,test.example.com
Sidenote: .zt
is used by the ZeroTier VPN solution. Not relevant for the overall discussion. Just a note if anybody asks.
Requiring view generally ist clumsy as it enforces using it for importing even if the environment does not have any non-default views.
It is indeed clumsy. I do not disagree. On the other hand. It makes the use of the bulk importer painful. As the error msg presented (by Netbox) is misleading, IMHO.
I believe you that you tried ... that's why it's a bug :-)
I can import the example you provided without a view and without any problem:
zone,name,type,value
example.com,test1,CNAME,test.othersubdomain.example.comg
What error are you seeing?
(when you define a CNAME, never forget the dot at the end of the value!)
zone,name,type,value
zt,test1,CNAME,test.example.com
works as well after adding the zone zt
.
I think now I could reproduce it:
zt
in view internal
external
(the view and zone names don't matter as long as the views are not default and the zone names are identical)zone,name,type,value
zt,test1,CNAME,test.example.com
Resulting error message: "Record 1 zone: Object not found: zt"
Is this correct?
Bottom line:
Versions NetBox Version: 4.1.4 NetBox DNS Version: 1.1.4 Python Version: 3.11 (Debian Bookworm Stable)
Describe the bug The bulk (CSV) importer will fail the import if the view column is omitted.
To Reproduce Steps to reproduce the behavior:
Expected result
The importer fails the task when using the headers of "zone,name,type,value,status". But works when providing the columns of "view,zone,name,type,value,status"
Actual result
The listed required columns are "name,name,type,value". The importer will fail, if the view column is omitted with the message "object not found".
Code Examples
(Requires the view to exist prior to import, view_name is case-sensitive)