-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
Environment
- Python version: 3.7.3
- NetBox version: 2.8.0 and master
When we try to create a vlan via the RESTapi the result is 500 when we try to set the group,
we tested this with v2.8.0 and master branch,
before the update from v2.7.8 this where working fine.
Steps to Reproduce
- Disable any installed plugins by commenting out the
PLUGINSsetting in
configuration.py. - create site
KAR-DC - create VLAN groups
GET "api/ipam/vlan-groups/"
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "C01",
"slug": "c01",
"site": {
"id": 1,
"url": "http://xxx/api/dcim/sites/1/",
"name": "KAR-DC",
"slug": "kar-dc"
},
"description": "",
"vlan_count": 13
},
{
"id": 2,
"name": "QA",
"slug": "qa",
"site": {
"id": 1,
"url": "http://xxx/api/dcim/sites/1/",
"name": "KAR-DC",
"slug": "kar-dc"
},
"description": "",
"vlan_count": 2
}
]
}
- send POST
curl -X POST "http://xxx/api/ipam/vlans/" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: " -d "{ \"vid\": 3098, \"name\": \"sgu-8-lan\", \"group\": { \"slug\": \"c01\" }}"
Expected Behavior
VLAN is created
Observed Behavior
error:
AttributeError at /api/ipam/vlans/
'UniqueTogetherValidator' object has no attribute 'set_context'
Request Method: POST
Request URL: http://10.0.192.20/api/ipam/vlans/
Django Version: 3.0.5
Python Executable: /opt/netbox/venv/bin/python3
Python Version: 3.7.3
Python Path: ['/opt/netbox/venv/bin', '/opt/netbox/netbox', '/', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/opt/netbox/venv/lib/python3.7/site-packages']
Server time: Wed, 15 Apr 2020 10:01:42 +0000
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'cacheops',
'corsheaders',
'debug_toolbar',
'django_filters',
'django_tables2',
'django_prometheus',
'mptt',
'rest_framework',
'taggit',
'taggit_serializer',
'timezone_field',
'circuits',
'dcim',
'ipam',
'extras',
'secrets',
'tenancy',
'users',
'utilities',
'virtualization',
'django_rq',
'drf_yasg']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'utilities.middleware.ExceptionHandlingMiddleware',
'utilities.middleware.RemoteUserMiddleware',
'utilities.middleware.LoginRequiredMiddleware',
'utilities.middleware.APIVersionMiddleware',
'extras.middleware.ObjectChangeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware']
Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/netbox/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/netbox/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/api.py", line 330, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/mixins.py", line 18, in create
serializer.is_valid(raise_exception=True)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/serializers.py", line 234, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/opt/netbox/venv/lib/python3.7/site-packages/rest_framework/serializers.py", line 436, in run_validation
value = self.validate(value)
File "/opt/netbox/netbox/ipam/api/serializers.py", line 125, in validate
validator.set_context(self)
Exception Type: AttributeError at /api/ipam/vlans/
Exception Value: 'UniqueTogetherValidator' object has no attribute 'set_context'
DouglasHeriot
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application