You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create a quarantine rule in Arnold (/arnold/addquarantinevlan/) for a vlan that already has a quarantine rule, you get a 500 error (See traceback for details)
To Reproduce
Steps to reproduce the behavior: (replace X with any number you want to use, e.g. 100)
Go to/arnold/addquarantinevlan/
Enter vlan X into the vlan input box on the right
Click Add vlan
Enter vlan X into the vlan input box on the right
Click Add vlan
See error
Expected behavior
Since the same Vlan cannot be quarantined twice, I would expect a non-500 error saying that plainly beneath the form or something.
Screenshots
Tracebacks
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
The above exception (duplicate key value violates unique constraint "quarantine_vlan_unique"
DETAIL: Key (vlan)=(1) already exists.
) was the direct cause of the following exception:
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/arnold/views.py", line 462, in render_quarantine_vlans
process_quarantinevlan_form(form)
File "/source/python/nav/web/arnold/views.py", line 502, in process_quarantinevlan_form
qvlan.save()
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/base.py", line 739, in save
self.save_base(using=using, force_insert=force_insert,
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/base.py", line 776, in save_base
updated = self._save_table(
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/base.py", line 881, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/base.py", line 919, in _do_insert
return manager._insert(
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/query.py", line 1270, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
cursor.execute(sql, params)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
Exception Type: IntegrityError at /arnold/addquarantinevlan/
Exception Value: duplicate key value violates unique constraint "quarantine_vlan_unique"
DETAIL: Key (vlan)=(1) already exists.
The text was updated successfully, but these errors were encountered:
Describe the bug
If you create a quarantine rule in Arnold (
/arnold/addquarantinevlan/
) for a vlan that already has a quarantine rule, you get a 500 error (See traceback for details)To Reproduce
Steps to reproduce the behavior: (replace X with any number you want to use, e.g. 100)
/arnold/addquarantinevlan/
Add vlan
Add vlan
Expected behavior
Since the same Vlan cannot be quarantined twice, I would expect a non-500 error saying that plainly beneath the form or something.
Screenshots
Tracebacks
The text was updated successfully, but these errors were encountered: