From 103939ad3c05bf50fd46ce99a910813c7732ced0 Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Fri, 12 Sep 2025 15:53:08 +0200 Subject: [PATCH] Fixes #20197: Correct validation for virtual chassis parent interface (#20337) --- netbox/dcim/models/device_components.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index f1e460d77..9e1d7b61e 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -872,14 +872,14 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd "The selected parent interface ({interface}) belongs to a different device ({device})" ).format(interface=self.parent, device=self.parent.device) }) - elif self.parent.device.virtual_chassis != self.parent.virtual_chassis: + elif self.parent.device.virtual_chassis != self.device.virtual_chassis: raise ValidationError({ 'parent': _( "The selected parent interface ({interface}) belongs to {device}, which is not part of " "virtual chassis {virtual_chassis}." ).format( interface=self.parent, - device=self.parent_device, + device=self.parent.device, virtual_chassis=self.device.virtual_chassis ) }) @@ -890,7 +890,7 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd if self.pk and self.bridge_id == self.pk: raise ValidationError({'bridge': _("An interface cannot be bridged to itself.")}) - # A bridged interface belong to the same device or virtual chassis + # A bridged interface belongs to the same device or virtual chassis if self.bridge and self.bridge.device != self.device: if self.device.virtual_chassis is None: raise ValidationError({