From 5e01d9c97bbb7d7c9616b64164bd0a0cc1ff2ccf Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 2 Sep 2020 11:50:50 -0400 Subject: [PATCH] Handle unresolvable switches gracecfully Rather than a trace log, keep it to only the event log. --- confluent_server/confluent/networking/macmap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/networking/macmap.py b/confluent_server/confluent/networking/macmap.py index 68bb619d..9a0aa93f 100644 --- a/confluent_server/confluent/networking/macmap.py +++ b/confluent_server/confluent/networking/macmap.py @@ -32,6 +32,7 @@ # This functionality is restricted to the null tenant from confluent.networking.lldp import _handle_neighbor_query, get_fingerprint from confluent.networking.netutil import get_switchcreds, list_switches, get_portnamemap +import eventlet.green.socket as socket if __name__ == '__main__': import sys @@ -105,7 +106,7 @@ def _namesmatch(switchdesc, userdesc): def _map_switch(args): try: return _map_switch_backend(args) - except UnicodeError: + except (UnicodeError, socket.gaierror): log.log({'error': "Cannot resolve switch '{0}' to an address".format( args[0])}) except exc.TargetEndpointUnreachable: