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)