Internal Server error creating a zone with a custom field from a template
Closed this issue · 0 comments
peteeckel commented
Versions
NetBox Version: 4.0.8
NetBox DNS Version: 1.0.5
Python Version: 3.11.5
Describe the bug
When a custom field is defined for Zone
objects, creating zones with templates fails with an internal server error.
To Reproduce
Steps to reproduce the behavior:
- Create an arbitrary custom field for
Zone
objects - Create an arbitrary zone template
- Try to create a zone with the zone template selected
Expected result
The zone is created with data from the zone template (if any)
Actual result
An internal server error is raised:
Traceback (most recent call last):
File "/opt/netbox/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 180, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/base.py", line 26, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/utilities/views.py", line 113, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 268, in post
if form.is_valid():
^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/forms/forms.py", line 197, in is_valid
return self.is_bound and not self.errors
^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/forms/forms.py", line 192, in errors
self.full_clean()
^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/forms/forms.py", line 328, in full_clean
self._clean_form()
^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/forms/forms.py", line 349, in _clean_form
cleaned_data = self.clean()
^^^^^^^^^^^^
File "/vagrant/netbox-dns/netbox_dns/forms/zone.py", line 91, in clean
zone = Zone.objects.create(**zone_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/query.py", line 677, in create
obj = self.model(**kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/vagrant/netbox-dns/netbox_dns/models/zone.py", line 75, in __init__
super().__init__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vagrant/netbox-dns/netbox_dns/mixins/object_modification.py", line 9, in __init__
super().__init__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/base.py", line 567, in __init__
raise TypeError(
^
Exception Type: TypeError at /plugins/netbox-dns/zones/add/
Exception Value: Zone() got unexpected keyword arguments: 'cf_test'