Update wireless link to support catching the "pretty" error.

This commit is contained in:
Daniel Sheppard 2025-02-26 08:17:39 -06:00
parent e11ee36f7a
commit f7296baa58

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)