Parcourir la source

Fixes #6398: Avoid exception when deleting device connected to self via circuit

jeremystretch il y a 4 ans
Parent
commit
834b233c30
2 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 1 0
      docs/release-notes/version-2.11.md
  2. 3 2
      netbox/dcim/signals.py

+ 1 - 0
docs/release-notes/version-2.11.md

@@ -9,6 +9,7 @@
 ### Bug Fixes
 
 * [#6376](https://github.com/netbox-community/netbox/issues/6376) - Fix assignment of VLAN groups to clusters, cluster groups via REST API
+* [#6398](https://github.com/netbox-community/netbox/issues/6398) - Avoid exception when deleting device connected to self via circuit
 
 ---
 

+ 3 - 2
netbox/dcim/signals.py

@@ -31,9 +31,10 @@ def rebuild_paths(obj):
 
     with transaction.atomic():
         for cp in cable_paths:
-            invalidate_obj(cp.origin)
             cp.delete()
-            create_cablepath(cp.origin)
+            if cp.origin:
+                invalidate_obj(cp.origin)
+                create_cablepath(cp.origin)
 
 
 #