move static clean_check to helpers

This commit is contained in:
Nicholas St. Germain 2018-12-11 11:45:43 -06:00
parent 176be580b7
commit 1cfcbe6d1e
2 changed files with 26 additions and 34 deletions

View file

@ -109,3 +109,21 @@ def mkdir_p(path):
os.makedirs(path, exist_ok=True)
except Exception as e:
logger.error('Could not create folder %s : %s ', path, e)
def clean_sid_check(server_id_list, server_type=None):
t = server_type
sid_list = server_id_list
cleaned_list = sid_list.replace(' ', '').split(',')
valid_sids = []
for sid in cleaned_list:
try:
valid_sids.append(int(sid))
except ValueError:
logger.error("{} is not a valid server id number".format(sid))
if valid_sids:
logger.info('%s : %s', t.upper(), valid_sids)
return valid_sids
else:
logger.error('No valid %s', t.upper())
return False