forked from p34709852/monkey
Create data_dir before logger is set up
This commit is contained in:
parent
82463416f8
commit
808e86df1a
|
@ -10,6 +10,12 @@ import os # noqa: E402
|
|||
from monkey_island import config_loader # noqa: E402
|
||||
from monkey_island.cc.server_utils.island_logger import setup_logging # noqa: E402
|
||||
|
||||
|
||||
def create_data_dir(data_dir):
|
||||
if not os.path.isdir(data_dir):
|
||||
os.makedirs(data_dir, mode=0o700)
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
island_args = parse_cli_args()
|
||||
|
||||
|
@ -23,6 +29,8 @@ if "__main__" == __name__:
|
|||
|
||||
config = config_loader.load_server_config_from_file(server_config_path)
|
||||
|
||||
create_data_dir(config["data_dir"])
|
||||
|
||||
setup_logging(config["data_dir"], config["log_level"])
|
||||
|
||||
except OSError as ex:
|
||||
|
|
|
@ -41,8 +41,6 @@ def main(
|
|||
):
|
||||
logger.info("Starting bootloader server")
|
||||
|
||||
create_data_dir(data_dir)
|
||||
|
||||
env_singleton.initialize_from_file(server_config_filename)
|
||||
initialize_encryptor(data_dir)
|
||||
initialize_services(data_dir)
|
||||
|
@ -57,11 +55,6 @@ def main(
|
|||
bootloader_server_thread.join()
|
||||
|
||||
|
||||
def create_data_dir(data_dir):
|
||||
if not os.path.isdir(data_dir):
|
||||
os.makedirs(data_dir, mode=0o700)
|
||||
|
||||
|
||||
def start_island_server(should_setup_only):
|
||||
mongo_url = os.environ.get("MONGO_URL", env_singleton.env.get_mongo_url())
|
||||
wait_for_mongo_db_server(mongo_url)
|
||||
|
|
Loading…
Reference in New Issue