From 9c6a16f9832d4b5555e5d60bfbc58aad3bb4695f Mon Sep 17 00:00:00 2001 From: JDierkse Date: Tue, 9 Mar 2021 15:36:11 +0100 Subject: [PATCH] Fix interface cleanup --- net-dhcp/network.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net-dhcp/network.py b/net-dhcp/network.py index cc1b5e5..fe858f0 100644 --- a/net-dhcp/network.py +++ b/net-dhcp/network.py @@ -253,12 +253,17 @@ def delete_endpoint(): if_host, _if_container = veth_pair(req['EndpointID']) if_host = interface.GetInterface(LIBRARY, if_host) - if library == 'NDB': - bridge = net_bridge(req['NetworkID']) - interface.DelPort(LIBRARY, bridge.ifname, if_host.ifname) - else: - interface.DelPort(LIBRARY, 'dummy0', if_host.ifname) - interface.RemoveInterface(LIBRARY, if_host.ifname) + try: + if LIBRARY == 'NDB': + logger.info('1') + bridge = net_bridge(req['NetworkID']) + interface.DelPort(LIBRARY, bridge.ifname, if_host.ifname) + else: + logger.info('2') + interface.DelPort(LIBRARY, 'dummy0', if_host.ifname) + interface.RemoveInterface(LIBRARY, if_host.ifname) + except Exception as e: + logger.exception(e) return jsonify({})