From 409a3c5234ffaa80b1efdfe3051c313997fcaea1 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 19 May 2021 17:01:50 +0300 Subject: [PATCH] Refactored code duplication by adding a parameter for create_data_dir --- monkey/monkey_island.py | 2 +- .../monkey_island/cc/environment/server_config_generator.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island.py b/monkey/monkey_island.py index 55a6d0475..76399b6ff 100644 --- a/monkey/monkey_island.py +++ b/monkey/monkey_island.py @@ -25,7 +25,7 @@ if "__main__" == __name__: config = config_loader.load_server_config_from_file(server_config_path) - create_data_dir(config["data_dir"]) + create_data_dir(config["data_dir"], True) setup_logging(config["data_dir"], config["log_level"]) diff --git a/monkey/monkey_island/cc/environment/server_config_generator.py b/monkey/monkey_island/cc/environment/server_config_generator.py index 45dde6f78..fd47889ea 100644 --- a/monkey/monkey_island/cc/environment/server_config_generator.py +++ b/monkey/monkey_island/cc/environment/server_config_generator.py @@ -1,7 +1,7 @@ import os from pathlib import Path -from monkey_island.cc.environment.data_dir_generator import create_default_data_dir +from monkey_island.cc.environment.data_dir_generator import create_data_dir from monkey_island.cc.server_utils.consts import ( DEFAULT_DEVELOP_SERVER_CONFIG_PATH, DEFAULT_SERVER_CONFIG_PATH, @@ -10,7 +10,7 @@ from monkey_island.cc.server_utils.consts import ( def create_default_server_config_file() -> str: if not os.path.isfile(DEFAULT_SERVER_CONFIG_PATH): - create_default_data_dir() + create_data_dir(DEFAULT_SERVER_CONFIG_PATH, False) write_default_server_config_to_file(DEFAULT_SERVER_CONFIG_PATH) return DEFAULT_SERVER_CONFIG_PATH