From 1113c2a8497ba9600cc15aa10423078bfa69efb9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 Oct 2020 13:36:45 -0400 Subject: [PATCH] Improve duplicate switch attribute errors --- confluent_server/confluent/networking/macmap.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/networking/macmap.py b/confluent_server/confluent/networking/macmap.py index 9a0aa93f..291b31aa 100644 --- a/confluent_server/confluent/networking/macmap.py +++ b/confluent_server/confluent/networking/macmap.py @@ -375,12 +375,19 @@ def _full_updatemacmap(configmanager): continue if curswitch not in _switchportmap: _switchportmap[curswitch] = {} - if portname in _switchportmap[curswitch]: - log.log({'error': 'Duplicate switch topology config ' - 'for {0} and {1}'.format( - node, + if (portname in _switchportmap[curswitch] and + _switchportmap[curswitch][portname] != node): + if _switchportmap[curswitch][portname] is None: + errstr = ('Duplicate switch attributes for {0} and ' + 'a previously logged duplicate'.format( + node)) + else: + errstr = ('Duplicate switch topology config ' + 'for {0} and {1}'.format( + node, _switchportmap[curswitch][ - portname])}) + portname])) + log.log({'error': errstr}) _switchportmap[curswitch][portname] = None else: _switchportmap[curswitch][portname] = node