-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: 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
Milestone
Description
Deployment Type
Self-hosted
NetBox Version
v4.3.6
Python Version
3.11
Steps to Reproduce
- Create a group "Administrators" and add the "admin" user
- Create a notification group "Admin Notifications" and add the group "Administrators"
- Create an event rule "IP Address Notifications" for "IPAM -> IPAddress" objects and at least event type "Object updated"
- Create a new IP address
- Edit the IP address and change something (e.g. the description)
Expected Behavior
The IP address is modified and a notification about the update is sent to the admin user.
Observed Behavior
An exception is raised:
Traceback (most recent call last):
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The above exception (duplicate key value violates unique constraint "extras_notification_unique_per_object_and_user"
DETAIL: Key (object_type_id, object_id, user_id)=(69, 19, 1) already exists.) was the direct cause of the following exception:
File "/opt/netbox/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/middleware.py", line 39, in __call__
with ExitStack() as stack:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/contextlib.py", line 589, in __exit__
raise exc_details[1]
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/contextlib.py", line 574, in __exit__
if cb(*exc_details):
^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/context_managers.py", line 24, in event_tracking
flush_events(events)
^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/extras/events.py", line 194, in flush_events
func(events)
^^^^^^^^^^^^
File "/opt/netbox/netbox/extras/events.py", line 175, in process_event_queue
process_event_rules(
^
File "/opt/netbox/netbox/extras/events.py", line 143, in process_event_rules
event_rule.action_object.notify(
^
File "/opt/netbox/netbox/extras/models/notifications.py", line 180, in notify
Notification.objects.bulk_create([
^^
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 823, in bulk_create
returned_columns = self._batched_insert(
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/query.py", line 1896, in _batched_insert
self._insert(
^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/query.py", line 1868, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/models/sql/compiler.py", line 1882, in execute_sql
cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/lib64/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: IntegrityError at /ipam/ip-addresses/19/edit/
Exception Value: duplicate key value violates unique constraint "extras_notification_unique_per_object_and_user"
DETAIL: Key (object_type_id, object_id, user_id)=(69, 19, 1) already exists.
Metadata
Metadata
Assignees
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: 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