Island: Wrap mongo start in _initialize_mongodb_connection()
This commit is contained in:
parent
82c7782ff0
commit
61cb14d628
|
@ -52,11 +52,7 @@ def run_monkey_island():
|
|||
_configure_logging(config_options)
|
||||
container = _initialize_di_container(config_options.data_dir)
|
||||
|
||||
mongo_db_process = None
|
||||
if config_options.start_mongodb:
|
||||
mongo_db_process = _start_mongodb(config_options.data_dir)
|
||||
|
||||
_connect_to_mongodb(mongo_db_process)
|
||||
_initialize_mongodb_connection(config_options.start_mongodb, config_options.data_dir)
|
||||
|
||||
_configure_gevent_exception_handling(config_options.data_dir)
|
||||
_start_island_server(island_args.setup_only, config_options, container)
|
||||
|
@ -95,6 +91,14 @@ def _initialize_di_container(data_dir: Path) -> DIContainer:
|
|||
return initialize_services(data_dir)
|
||||
|
||||
|
||||
def _initialize_mongodb_connection(start_mongodb: bool, data_dir: Path):
|
||||
mongo_db_process = None
|
||||
if start_mongodb:
|
||||
mongo_db_process = _start_mongodb(data_dir)
|
||||
|
||||
_connect_to_mongodb(mongo_db_process)
|
||||
|
||||
|
||||
def _start_mongodb(data_dir: Path) -> MongoDbProcess:
|
||||
mongo_db_process = mongo_setup.start_mongodb(data_dir)
|
||||
mongo_setup.register_mongo_shutdown_callback(mongo_db_process)
|
||||
|
|
Loading…
Reference in New Issue