From 9eedac4eb252276fc68333e006a66337963e5fcf Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 17 May 2021 16:46:39 +0530 Subject: [PATCH] Move `create_data_dir()` from monkey_island.py to monkey_island/cc/setup.py --- monkey/monkey_island.py | 7 +------ monkey/monkey_island/cc/setup.py | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island.py b/monkey/monkey_island.py index 31fa26382..4f28bc606 100644 --- a/monkey/monkey_island.py +++ b/monkey/monkey_island.py @@ -9,12 +9,7 @@ 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) - +from monkey_island.cc.setup import create_data_dir # noqa: E402 if "__main__" == __name__: island_args = parse_cli_args() diff --git a/monkey/monkey_island/cc/setup.py b/monkey/monkey_island/cc/setup.py index a03c554be..fbe709dec 100644 --- a/monkey/monkey_island/cc/setup.py +++ b/monkey/monkey_island/cc/setup.py @@ -1,4 +1,5 @@ import logging +import os from pymongo import errors @@ -49,3 +50,8 @@ def store_mitigations_on_mongo(): ) for key, mongo_object in mongo_mitigations.items(): mongo_object.save() + + +def create_data_dir(data_dir): + if not os.path.isdir(data_dir): + os.makedirs(data_dir, mode=0o700)