Refactored code duplication by adding a parameter for create_data_dir

This commit is contained in:
VakarisZ 2021-05-19 17:01:50 +03:00 committed by Shreya
parent 8ce506ac6f
commit 409a3c5234
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ if "__main__" == __name__:
config = config_loader.load_server_config_from_file(server_config_path) 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"]) setup_logging(config["data_dir"], config["log_level"])

View File

@ -1,7 +1,7 @@
import os import os
from pathlib import Path 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 ( from monkey_island.cc.server_utils.consts import (
DEFAULT_DEVELOP_SERVER_CONFIG_PATH, DEFAULT_DEVELOP_SERVER_CONFIG_PATH,
DEFAULT_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: def create_default_server_config_file() -> str:
if not os.path.isfile(DEFAULT_SERVER_CONFIG_PATH): 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) write_default_server_config_to_file(DEFAULT_SERVER_CONFIG_PATH)
return DEFAULT_SERVER_CONFIG_PATH return DEFAULT_SERVER_CONFIG_PATH