Explorar o código

Fixes #14363: Fix bulk editing of interfaces assigned to VM with no cluster

Jeremy Stretch %!s(int64=2) %!d(string=hai) anos
pai
achega
792b353f64
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      netbox/virtualization/forms/bulk_edit.py

+ 3 - 2
netbox/virtualization/forms/bulk_edit.py

@@ -294,9 +294,10 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm):
                 # Check interface sites.  First interface should set site, further interfaces will either continue the
                 # Check interface sites.  First interface should set site, further interfaces will either continue the
                 # loop or reset back to no site and break the loop.
                 # loop or reset back to no site and break the loop.
                 for interface in interfaces:
                 for interface in interfaces:
+                    vm_site = interface.virtual_machine.site or interface.virtual_machine.cluster.site
                     if site is None:
                     if site is None:
-                        site = interface.virtual_machine.cluster.site
-                    elif interface.virtual_machine.cluster.site is not site:
+                        site = vm_site
+                    elif vm_site is not site:
                         site = None
                         site = None
                         break
                         break