2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

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.
This commit is contained in:
Jarrod Johnson 2016-07-15 16:47:42 -04:00
parent 9516efd74a
commit 7b160bd99c

View File

@ -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: