From 7b160bd99c1c11363a2055dd2fb5e684950285ef Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 15 Jul 2016 16:47:42 -0400 Subject: [PATCH] Fix namesmatch to actually return True In the common case, we were falling through the bottom without an explicit return. Restructure things to both explicitly return and look a bit more sane. --- confluent_server/confluent/networking/macmap.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/confluent_server/confluent/networking/macmap.py b/confluent_server/confluent/networking/macmap.py index 29344b09..b764929a 100644 --- a/confluent_server/confluent/networking/macmap.py +++ b/confluent_server/confluent/networking/macmap.py @@ -80,12 +80,12 @@ def _namesmatch(switchdesc, userdesc): if snum == portnum: return True anymatch = re.search(r'[^0123456789]' + userdesc + r'(\.0)?\Z', switchdesc) - if not anymatch: - return False - for blexp in _blacklistnames: - if blexp.match(switchdesc): - return False - + if anymatch: + for blexp in _blacklistnames: + if blexp.match(switchdesc): + return False + return True + return False def _map_switch(args): try: