mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #2816: Handle exception when deleting a device with connected components
This commit is contained in:
parent
0256448dd8
commit
8bd9b258a8
@ -20,6 +20,7 @@ v2.5.4 (FUTURE)
|
|||||||
* [#2795](https://github.com/digitalocean/netbox/issues/2795) - Fix duplicate display of pagination controls on child prefix/IP tables
|
* [#2795](https://github.com/digitalocean/netbox/issues/2795) - Fix duplicate display of pagination controls on child prefix/IP tables
|
||||||
* [#2798](https://github.com/digitalocean/netbox/issues/2798) - Properly URL-encode "map it" link on site view
|
* [#2798](https://github.com/digitalocean/netbox/issues/2798) - Properly URL-encode "map it" link on site view
|
||||||
* [#2802](https://github.com/digitalocean/netbox/issues/2802) - Better error handling for unsupported NAPALM methods
|
* [#2802](https://github.com/digitalocean/netbox/issues/2802) - Better error handling for unsupported NAPALM methods
|
||||||
|
* [#2816](https://github.com/digitalocean/netbox/issues/2816) - Handle exception when deleting a device with connected components
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -54,7 +54,11 @@ class ComponentModel(models.Model):
|
|||||||
"""
|
"""
|
||||||
Log an ObjectChange including the parent Device/VM.
|
Log an ObjectChange including the parent Device/VM.
|
||||||
"""
|
"""
|
||||||
parent = self.device if self.device is not None else getattr(self, 'virtual_machine', None)
|
try:
|
||||||
|
parent = getattr(self, 'device', None) or getattr(self, 'virtual_machine', None)
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
# The parent device/VM has already been deleted
|
||||||
|
parent = None
|
||||||
ObjectChange(
|
ObjectChange(
|
||||||
user=user,
|
user=user,
|
||||||
request_id=request_id,
|
request_id=request_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user