Fixes: #15016 - Catch AssertionError from cable trace and throw ValidationError (#16384)

This commit is contained in:
Daniel Sheppard
2025-03-04 12:57:27 -06:00
committed by GitHub
parent d208ddde9a
commit 4ab58f2da9
4 changed files with 34 additions and 15 deletions

View File

@@ -3,8 +3,10 @@ import logging
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from dcim.exceptions import UnsupportedCablePath
from dcim.models import CablePath, Interface
from dcim.utils import create_cablepath
from utilities.exceptions import AbortRequest
from .models import WirelessLink
@@ -34,7 +36,10 @@ def update_connected_interfaces(instance, created, raw=False, **kwargs):
# Create/update cable paths
if created:
for interface in (instance.interface_a, instance.interface_b):
create_cablepath([interface])
try:
create_cablepath([interface])
except UnsupportedCablePath as e:
raise AbortRequest(e)
@receiver(post_delete, sender=WirelessLink)