mirror of https://github.com/MISP/misp-dashboard
chg: [diagnostic] Moved timeoutException into util and bumped
requirementsdiagnosticTool
parent
1d7e6c185e
commit
3545eaa970
|
@ -45,16 +45,7 @@ pgrep_subscriber_output = ''
|
||||||
pgrep_dispatcher_output = ''
|
pgrep_dispatcher_output = ''
|
||||||
|
|
||||||
|
|
||||||
class TimeoutException(Exception):
|
signal.signal(signal.SIGALRM, diagnostic_util.timeout_handler)
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def timeout_handler(signum, frame):
|
|
||||||
raise TimeoutException
|
|
||||||
|
|
||||||
|
|
||||||
signal.signal(signal.SIGALRM, timeout_handler)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def humanize(name, isResult=False):
|
def humanize(name, isResult=False):
|
||||||
|
@ -238,7 +229,7 @@ def check_subscriber_status(spinner):
|
||||||
if action == '"LPUSH"' and target == f'\"{configuration_file.get("RedisLIST", "listName")}\"':
|
if action == '"LPUSH"' and target == f'\"{configuration_file.get("RedisLIST", "listName")}\"':
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
break
|
break
|
||||||
except TimeoutException:
|
except diagnostic_util.TimeoutException:
|
||||||
return_text = f'''zmq_subscriber seems not to be working.
|
return_text = f'''zmq_subscriber seems not to be working.
|
||||||
\t➥ Consider restarting it: {pgrep_subscriber_output}'''
|
\t➥ Consider restarting it: {pgrep_subscriber_output}'''
|
||||||
return (False, return_text)
|
return (False, return_text)
|
||||||
|
@ -383,7 +374,7 @@ def check_server_dynamic_enpoint(spinner):
|
||||||
return_flag = False
|
return_flag = False
|
||||||
return_text = f'Something went wrong. Output {line}'
|
return_text = f'Something went wrong. Output {line}'
|
||||||
break
|
break
|
||||||
except TimeoutException:
|
except diagnostic_util.TimeoutException:
|
||||||
return_text = f'Dynamic endpoint did not returned data in the given time ({int(time.time()-start_time)}sec)'
|
return_text = f'Dynamic endpoint did not returned data in the given time ({int(time.time()-start_time)}sec)'
|
||||||
return (return_flag, return_text)
|
return (return_flag, return_text)
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,14 @@ def dict_compare(dict1, dict2):
|
||||||
return (False, faulties)
|
return (False, faulties)
|
||||||
|
|
||||||
|
|
||||||
|
class TimeoutException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def timeout_handler(signum, frame):
|
||||||
|
raise TimeoutException
|
||||||
|
|
||||||
|
|
||||||
# https://stackoverflow.com/a/10464730
|
# https://stackoverflow.com/a/10464730
|
||||||
class Monitor():
|
class Monitor():
|
||||||
def __init__(self, connection_pool):
|
def __init__(self, connection_pool):
|
||||||
|
|
|
@ -7,3 +7,5 @@ phonenumbers
|
||||||
pip
|
pip
|
||||||
pycountry
|
pycountry
|
||||||
zmq
|
zmq
|
||||||
|
requests
|
||||||
|
halo
|
||||||
|
|
Loading…
Reference in New Issue