mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #4221: Fix exception when deleting a device with interface connections when an interfaces webhook is defined
This commit is contained in:
parent
4e76e4ec9c
commit
909971f237
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
* [#4221](https://github.com/netbox-community/netbox/issues/4221) - Fix exception when deleting a device with interface connections when an interfaces webhook is defined
|
||||||
* [#4224](https://github.com/netbox-community/netbox/issues/4224) - Fix display of rear device image if front image is not defined
|
* [#4224](https://github.com/netbox-community/netbox/issues/4224) - Fix display of rear device image if front image is not defined
|
||||||
* [#4228](https://github.com/netbox-community/netbox/issues/4228) - Improve fit of device images in rack elevations
|
* [#4228](https://github.com/netbox-community/netbox/issues/4228) - Improve fit of device images in rack elevations
|
||||||
* [#4230](https://github.com/netbox-community/netbox/issues/4230) - Fix rack units filtering on elevation endpoint
|
* [#4230](https://github.com/netbox-community/netbox/issues/4230) - Fix rack units filtering on elevation endpoint
|
||||||
|
@ -360,9 +360,21 @@ class PowerPort(CableTermination, ComponentModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def connected_endpoint(self):
|
def connected_endpoint(self):
|
||||||
if self._connected_poweroutlet:
|
"""
|
||||||
return self._connected_poweroutlet
|
Return the connected PowerOutlet, if it exists, or the connected PowerFeed, if it exists. We have to check for
|
||||||
return self._connected_powerfeed
|
ObjectDoesNotExist in case the referenced object has been deleted from the database.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if self._connected_poweroutlet:
|
||||||
|
return self._connected_poweroutlet
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if self._connected_powerfeed:
|
||||||
|
return self._connected_powerfeed
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
@connected_endpoint.setter
|
@connected_endpoint.setter
|
||||||
def connected_endpoint(self, value):
|
def connected_endpoint(self, value):
|
||||||
@ -717,9 +729,21 @@ class Interface(CableTermination, ComponentModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def connected_endpoint(self):
|
def connected_endpoint(self):
|
||||||
if self._connected_interface:
|
"""
|
||||||
return self._connected_interface
|
Return the connected Interface, if it exists, or the connected CircuitTermination, if it exists. We have to
|
||||||
return self._connected_circuittermination
|
check for ObjectDoesNotExist in case the referenced object has been deleted from the database.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if self._connected_interface:
|
||||||
|
return self._connected_interface
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if self._connected_circuittermination:
|
||||||
|
return self._connected_circuittermination
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
@connected_endpoint.setter
|
@connected_endpoint.setter
|
||||||
def connected_endpoint(self, value):
|
def connected_endpoint(self, value):
|
||||||
|
Loading…
Reference in New Issue
Block a user