Move `create_data_dir()` from monkey_island.py to monkey_island/cc/setup.py

This commit is contained in:
Shreya 2021-05-17 16:46:39 +05:30
parent 808e86df1a
commit 9eedac4eb2
2 changed files with 7 additions and 6 deletions

View File

@ -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()

View File

@ -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)