mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-25 15:27:17 +00:00
fix: [core] fix instance ail:uuid
This commit is contained in:
parent
8ec4370043
commit
2ae3ffd6d2
3 changed files with 19 additions and 3 deletions
|
@ -10,13 +10,23 @@ Init DB + Clear Stats
|
|||
|
||||
import os
|
||||
import sys
|
||||
import logging.config
|
||||
|
||||
sys.path.append(os.environ['AIL_BIN'])
|
||||
##################################
|
||||
# Import Project packages
|
||||
##################################
|
||||
from lib import ail_core
|
||||
from lib import ail_queues
|
||||
from lib import ail_logger
|
||||
|
||||
logging.config.dictConfig(ail_logger.get_config(name='modules'))
|
||||
logger = logging.getLogger()
|
||||
|
||||
if __name__ == "__main__":
|
||||
ail_queues.save_queue_digraph()
|
||||
ail_queues.clear_modules_queues_stats()
|
||||
|
||||
# Send module state to logs
|
||||
ail_uuid = ail_core.get_ail_uuid()
|
||||
logger.warning(f"AIL {ail_uuid} started")
|
||||
|
|
|
@ -18,7 +18,15 @@ config_loader = None
|
|||
AIL_OBJECTS = sorted({'cve', 'cryptocurrency', 'decoded', 'domain', 'item', 'pgp', 'screenshot', 'username'})
|
||||
|
||||
def get_ail_uuid():
|
||||
return r_serv_db.get('ail:uuid')
|
||||
ail_uuid = r_serv_db.get('ail:uuid')
|
||||
if not ail_uuid:
|
||||
ail_uuid = _set_ail_uuid()
|
||||
return ail_uuid
|
||||
|
||||
def _set_ail_uuid():
|
||||
ail_uuid = generate_uuid()
|
||||
r_serv_db.set('ail:uuid', ail_uuid)
|
||||
return ail_uuid
|
||||
|
||||
def generate_uuid():
|
||||
return str(uuid4())
|
||||
|
|
|
@ -68,8 +68,6 @@ class Global(AbstractModule):
|
|||
|
||||
# Send module state to logs
|
||||
self.logger.info(f"Module {self.module_name} initialized")
|
||||
# Send module state to logs # TODO MOVE ME IN INIT SCRIPT
|
||||
self.redis_logger.critical(f"AIL {get_ail_uuid()} started")
|
||||
|
||||
def computeNone(self):
|
||||
difftime = time.time() - self.time_last_stats
|
||||
|
|
Loading…
Reference in a new issue