From 7e21be587916e12010b40fd1e7483c6c0656bdf5 Mon Sep 17 00:00:00 2001 From: Iuri Malinoski Date: Mon, 31 Aug 2026 13:36:03 -0300 Subject: [PATCH 1/2] Append a more clear message to fix the problem. --- networkapi/api_neighbor/v4/exceptions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/networkapi/api_neighbor/v4/exceptions.py b/networkapi/api_neighbor/v4/exceptions.py index c2df486e..80cc0e6d 100644 --- a/networkapi/api_neighbor/v4/exceptions.py +++ b/networkapi/api_neighbor/v4/exceptions.py @@ -135,7 +135,9 @@ class LocalIpAndPeerGroupAtDifferentEnvironmentsException(APIException): def __init__(self, neighbor): self.detail = u'Not allowed to configure BGP neighbor using this Peer Group. ' \ - u'PeerGroup id = {} is not mapped to the environment of LocalIp id = {}'.\ + u'PeerGroup id = {} is not mapped to the environment of LocalIp id = {}. ' \ + u'The LocalIp environment must be associated with this PeerGroup ' \ + u'in the environment_peer_group table.'.\ format(neighbor.peer_group, neighbor.local_ip) From 601995c8c814e3de148b2f4560f7f0e9ff64f7bd Mon Sep 17 00:00:00 2001 From: Iuri Malinoski Date: Fri, 4 Sep 2026 17:10:58 -0300 Subject: [PATCH 2/2] Fix return error from exception block --- networkapi/interface/resource/InterfaceChannelResource.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/networkapi/interface/resource/InterfaceChannelResource.py b/networkapi/interface/resource/InterfaceChannelResource.py index e8710998..7a2f852b 100644 --- a/networkapi/interface/resource/InterfaceChannelResource.py +++ b/networkapi/interface/resource/InterfaceChannelResource.py @@ -22,6 +22,7 @@ from networkapi.ambiente.models import Ambiente from networkapi.api_interface import exceptions as api_interface_exceptions from networkapi.api_interface import facade as api_interface_facade +from networkapi.api_rest.exceptions import NetworkAPIException from networkapi.auth import has_perm from networkapi.exception import InvalidValueError from networkapi.infrastructure.xml_utils import dumps_networkapi @@ -366,11 +367,12 @@ def handle_delete(self, request, user, *args, **kwargs): vlan_nativa='1') api_interface_facade.delete_channel(user, e, equip_dict.get(e), channel) - except Exception: + except Exception, e: + self.log.error(u'Error undeploying channel configuration: %s' % e) if keep_db: channel.status_deploy = StatusDeploy.error[0] - channel.save(user) - raise + channel.save(user, commit=True) + return self.response_error(410, e) if not keep_db: channel.delete(user)