From 82463416f85fad02212eb6d863d85f53b6a3db13 Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 13 May 2021 15:07:02 +0530 Subject: [PATCH] Create data dir if `--server-config` is passed, "data_dir" field exists, but the dir doesn't exist --- monkey/monkey_island/cc/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/monkey_island/cc/main.py b/monkey/monkey_island/cc/main.py index cf56144ed..497323f8b 100644 --- a/monkey/monkey_island/cc/main.py +++ b/monkey/monkey_island/cc/main.py @@ -41,6 +41,8 @@ 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) @@ -55,6 +57,11 @@ 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)