Skip to content

AttributeError exception when removing a device from a virtual chassis with a branch active #349

@jeremystretch

Description

@jeremystretch

Plugin Version

v0.7.1

NetBox Version

v4.4.5

Python Version

3.12

Steps to Reproduce

  1. Create a virtual chassis comprising two devices. Designate the first device as the chassis master.
  2. Create and activate a branch
  3. Edit the virtual chassis in the UI and click the "remove" button for the second device under the members list.
  4. Confirm the removal.

Expected Behavior

The second device should be removed from the virtual chassis successfully.

Observed Behavior

An AttributeError exception is raised:

Traceback (most recent call last):
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/utilities/views.py", line 144, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/utilities/views.py", line 45, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/dcim/views.py", line 3925, in post
    device.save()
    ^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/dcim/models/devices.py", line 989, in save
    super().save(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/utilities/tracking.py", line 56, in save
    super().save(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/netbox/models/features.py", line 324, in save
    super().save(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 902, in save
    self.save_base(
    ^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 1023, in save_base
    post_save.send(
    ^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/dispatch/dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/core/signals.py", line 143, in handle_changed_object
    objectchange.save()
    ^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/netbox/core/models/change_logging.py", line 142, in save
    return super().save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 902, in save
    self.save_base(
    ^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 1023, in save_base
    post_save.send(
    ^
  File "/home/jstretch/projects/netbox/venv/lib/python3.12/site-packages/django/dispatch/dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/nbl-netbox-branching/netbox_branching/signal_receivers.py", line 97, in record_change_diff
    diff.save()
    ^^^^^^^^^^^
  File "/home/jstretch/projects/nbl-netbox-branching/netbox_branching/models/changes.py", line 181, in save
    self._update_conflicts()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jstretch/projects/nbl-netbox-branching/netbox_branching/models/changes.py", line 197, in _update_conflicts
    k for k, v in self.original.items()
                  ^^^^^^^^^^^^^^^^^^^

Exception Type: AttributeError at /dcim/virtual-chassis-members/108/delete/
Exception Value: 'NoneType' object has no attribute 'items'

Metadata

Metadata

Assignees

Labels

app: branchingseverity: mediumResults in substantial degraded or broken functionality for specific workflowsstatus: acceptedtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions