mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Merge pull request #10287 from netbox-community/10250-cable-import-virtual
Fixes #10250: Fix exception when CableTermination validation fails during bulk import of cables
This commit is contained in:
commit
770cc5a700
@ -281,15 +281,11 @@ class CableTermination(models.Model):
|
|||||||
|
|
||||||
# Validate interface type (if applicable)
|
# Validate interface type (if applicable)
|
||||||
if self.termination_type.model == 'interface' and self.termination.type in NONCONNECTABLE_IFACE_TYPES:
|
if self.termination_type.model == 'interface' and self.termination.type in NONCONNECTABLE_IFACE_TYPES:
|
||||||
raise ValidationError({
|
raise ValidationError(f"Cables cannot be terminated to {self.termination.get_type_display()} interfaces")
|
||||||
'termination': f'Cables cannot be terminated to {self.termination.get_type_display()} interfaces'
|
|
||||||
})
|
|
||||||
|
|
||||||
# A CircuitTermination attached to a ProviderNetwork cannot have a Cable
|
# A CircuitTermination attached to a ProviderNetwork cannot have a Cable
|
||||||
if self.termination_type.model == 'circuittermination' and self.termination.provider_network is not None:
|
if self.termination_type.model == 'circuittermination' and self.termination.provider_network is not None:
|
||||||
raise ValidationError({
|
raise ValidationError("Circuit terminations attached to a provider network may not be cabled.")
|
||||||
'termination': "Circuit terminations attached to a provider network may not be cabled."
|
|
||||||
})
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user