Skip to content

Commit 103939a

Browse files
authored
Fixes #20197: Correct validation for virtual chassis parent interface (#20337)
1 parent 4b17faa commit 103939a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

netbox/dcim/models/device_components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,14 +872,14 @@ def clean(self):
872872
"The selected parent interface ({interface}) belongs to a different device ({device})"
873873
).format(interface=self.parent, device=self.parent.device)
874874
})
875-
elif self.parent.device.virtual_chassis != self.parent.virtual_chassis:
875+
elif self.parent.device.virtual_chassis != self.device.virtual_chassis:
876876
raise ValidationError({
877877
'parent': _(
878878
"The selected parent interface ({interface}) belongs to {device}, which is not part of "
879879
"virtual chassis {virtual_chassis}."
880880
).format(
881881
interface=self.parent,
882-
device=self.parent_device,
882+
device=self.parent.device,
883883
virtual_chassis=self.device.virtual_chassis
884884
)
885885
})
@@ -890,7 +890,7 @@ def clean(self):
890890
if self.pk and self.bridge_id == self.pk:
891891
raise ValidationError({'bridge': _("An interface cannot be bridged to itself.")})
892892

893-
# A bridged interface belong to the same device or virtual chassis
893+
# A bridged interface belongs to the same device or virtual chassis
894894
if self.bridge and self.bridge.device != self.device:
895895
if self.device.virtual_chassis is None:
896896
raise ValidationError({

0 commit comments

Comments
 (0)