Improve limit handling

This commit is contained in:
2018-09-25 02:20:32 -04:00
parent 615169cd69
commit 7daed1b0d8
4 changed files with 66 additions and 22 deletions

View File

@ -121,12 +121,18 @@ def get_list(zk_conn, limit):
for router in full_router_list:
if limit != None:
try:
if re.match(limit, router) == None:
continue
# Implcitly assume fuzzy limits
if re.match('\^.*', limit) == None:
limit = '.*' + limit
if re.match('.*\$', limit) == None:
limit = limit + '.*'
if re.match(limit, router) != None:
router_list.append(router)
except Exception as e:
common.stopZKConnection(zk_conn)
return False, 'Regex Error: {}'.format(e)
router_list.append(router)
else:
router_list.append(router)
router_list_output = []
router_daemon_state = {}