mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fixes #2353: Handle DoesNotExist exception when deleting a device with connected interfaces
This commit is contained in:
parent
66400a98f1
commit
dbbf7ab664
@ -8,6 +8,7 @@ v2.4.4 (FUTURE)
|
|||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
* [#2353](https://github.com/digitalocean/netbox/issues/2353) - Handle `DoesNotExist` exception when deleting a device with connected interfaces
|
||||||
* [#2354](https://github.com/digitalocean/netbox/issues/2354) - Increased maximum MTU for interfaces to 65536 bytes
|
* [#2354](https://github.com/digitalocean/netbox/issues/2354) - Increased maximum MTU for interfaces to 65536 bytes
|
||||||
* [#2355](https://github.com/digitalocean/netbox/issues/2355) - Added item count to inventory tab on device view
|
* [#2355](https://github.com/digitalocean/netbox/issues/2355) - Added item count to inventory tab on device view
|
||||||
* [#2368](https://github.com/digitalocean/netbox/issues/2368) - Record change in device changelog when altering cluster assignment
|
* [#2368](https://github.com/digitalocean/netbox/issues/2368) - Record change in device changelog when altering cluster assignment
|
||||||
|
@ -2072,6 +2072,7 @@ class InterfaceConnection(models.Model):
|
|||||||
(self.interface_a, self.interface_b),
|
(self.interface_a, self.interface_b),
|
||||||
(self.interface_b, self.interface_a),
|
(self.interface_b, self.interface_a),
|
||||||
)
|
)
|
||||||
|
|
||||||
for interface, peer_interface in interfaces:
|
for interface, peer_interface in interfaces:
|
||||||
if action == OBJECTCHANGE_ACTION_DELETE:
|
if action == OBJECTCHANGE_ACTION_DELETE:
|
||||||
connection_data = {
|
connection_data = {
|
||||||
@ -2082,11 +2083,17 @@ class InterfaceConnection(models.Model):
|
|||||||
'connected_interface': peer_interface.pk,
|
'connected_interface': peer_interface.pk,
|
||||||
'connection_status': self.connection_status
|
'connection_status': self.connection_status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
parent_obj = interface.parent
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
parent_obj = None
|
||||||
|
|
||||||
ObjectChange(
|
ObjectChange(
|
||||||
user=user,
|
user=user,
|
||||||
request_id=request_id,
|
request_id=request_id,
|
||||||
changed_object=interface,
|
changed_object=interface,
|
||||||
related_object=interface.parent,
|
related_object=parent_obj,
|
||||||
action=OBJECTCHANGE_ACTION_UPDATE,
|
action=OBJECTCHANGE_ACTION_UPDATE,
|
||||||
object_data=serialize_object(interface, extra=connection_data)
|
object_data=serialize_object(interface, extra=connection_data)
|
||||||
).save()
|
).save()
|
||||||
|
Loading…
Reference in New Issue
Block a user