diff --git a/monkey/monkey_island/cc/resources/island_mode.py b/monkey/monkey_island/cc/resources/island_mode.py index 7698fca9d..ea2b8d946 100644 --- a/monkey/monkey_island/cc/resources/island_mode.py +++ b/monkey/monkey_island/cc/resources/island_mode.py @@ -5,7 +5,8 @@ import flask_restful from flask import make_response, request from monkey_island.cc.resources.auth.auth import jwt_required -from monkey_island.cc.services.mode.island_mode_service import ModeNotSetError, get_mode, set_mode +from monkey_island.cc.services.mode.get_island_mode_service import ModeNotSetError, get_mode +from monkey_island.cc.services.mode.set_island_mode_service import set_mode from monkey_island.cc.services.mode.mode_enum import IslandModeEnum logger = logging.getLogger(__name__) diff --git a/monkey/monkey_island/cc/services/mode/island_mode_service.py b/monkey/monkey_island/cc/services/mode/get_island_mode_service.py similarity index 60% rename from monkey/monkey_island/cc/services/mode/island_mode_service.py rename to monkey/monkey_island/cc/services/mode/get_island_mode_service.py index b745ebef1..1f27ad3b1 100644 --- a/monkey/monkey_island/cc/services/mode/island_mode_service.py +++ b/monkey/monkey_island/cc/services/mode/get_island_mode_service.py @@ -1,11 +1,4 @@ from monkey_island.cc.models.island_mode_model import IslandMode -from monkey_island.cc.services.mode.mode_enum import IslandModeEnum - - -def set_mode(mode: IslandModeEnum): - island_mode_model = IslandMode() - island_mode_model.mode = mode.value - island_mode_model.save() def get_mode() -> str: diff --git a/monkey/monkey_island/cc/services/mode/set_island_mode_service.py b/monkey/monkey_island/cc/services/mode/set_island_mode_service.py new file mode 100644 index 000000000..a1190e42a --- /dev/null +++ b/monkey/monkey_island/cc/services/mode/set_island_mode_service.py @@ -0,0 +1,10 @@ +from monkey_island.cc.models.island_mode_model import IslandMode +from monkey_island.cc.services.mode.mode_enum import IslandModeEnum +from monkey_island.cc.services.config import ConfigService + + +def set_mode(mode: IslandModeEnum): + island_mode_model = IslandMode() + island_mode_model.mode = mode.value + island_mode_model.save() + ConfigService.update_config_on_mode_set(mode.value)