diff --git a/monkey/monkey_island/cc/island_event_handlers/set_agent_configuration_per_island_mode.py b/monkey/monkey_island/cc/island_event_handlers/set_agent_configuration_per_island_mode.py index 7ed5e1188..8385d0480 100644 --- a/monkey/monkey_island/cc/island_event_handlers/set_agent_configuration_per_island_mode.py +++ b/monkey/monkey_island/cc/island_event_handlers/set_agent_configuration_per_island_mode.py @@ -1,5 +1,3 @@ -from typing import Any - from common.agent_configuration import AgentConfiguration from monkey_island.cc.models import IslandMode from monkey_island.cc.repository import IAgentConfigurationRepository @@ -20,8 +18,7 @@ class set_agent_configuration_per_island_mode: self._default_agent_configuration = default_agent_configuration self._default_ransomware_agent_configuration = default_ransomware_agent_configuration - def __call__(self, event: Any = None): - mode = event + def __call__(self, mode: IslandMode): if mode == IslandMode.RANSOMWARE: self._agent_configuration_repository.store_configuration( self._default_ransomware_agent_configuration diff --git a/monkey/monkey_island/cc/island_event_handlers/set_simulation_mode.py b/monkey/monkey_island/cc/island_event_handlers/set_simulation_mode.py index 3aff9d56d..da15a8ac0 100644 --- a/monkey/monkey_island/cc/island_event_handlers/set_simulation_mode.py +++ b/monkey/monkey_island/cc/island_event_handlers/set_simulation_mode.py @@ -1,5 +1,4 @@ -from typing import Any - +from monkey_island.cc.models import IslandMode from monkey_island.cc.repository import ISimulationRepository @@ -14,6 +13,5 @@ class set_simulation_mode: ): self._simulation_repository = simulation_repository - def __call__(self, event: Any = None): - mode = event + def __call__(self, mode: IslandMode): self._simulation_repository.set_mode(mode) diff --git a/monkey/monkey_island/cc/resources/island_mode.py b/monkey/monkey_island/cc/resources/island_mode.py index d553e7ea5..f07e791aa 100644 --- a/monkey/monkey_island/cc/resources/island_mode.py +++ b/monkey/monkey_island/cc/resources/island_mode.py @@ -28,7 +28,7 @@ class IslandMode(AbstractResource): def put(self): try: mode = IslandModeEnum(request.json) - self._island_event_queue.publish(topic=IslandEventTopic.SET_ISLAND_MODE, event=mode) + self._island_event_queue.publish(topic=IslandEventTopic.SET_ISLAND_MODE, mode=mode) return {}, HTTPStatus.NO_CONTENT except (AttributeError, json.decoder.JSONDecodeError): return {}, HTTPStatus.BAD_REQUEST