Island: Subscribe repository reset functions to CLEAR_SIMULATION_DATA event

This commit is contained in:
Shreya Malviya 2022-09-20 15:50:43 +05:30
parent 51a9bad000
commit f93565b2cf
1 changed files with 21 additions and 1 deletions

View File

@ -3,7 +3,13 @@ from functools import partial
from common import DIContainer
from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
from monkey_island.cc.island_event_handlers import reset_agent_configuration
from monkey_island.cc.repository import ICredentialsRepository
from monkey_island.cc.repository import (
IAgentEventRepository,
IAgentRepository,
ICredentialsRepository,
IMachineRepository,
INodeRepository,
)
from monkey_island.cc.services.database import Database
@ -32,3 +38,17 @@ def _subscribe_clear_simulation_data_events(
island_event_queue.subscribe(
IslandEventTopic.CLEAR_SIMULATION_DATA, credentials_repository.remove_stolen_credentials
)
node_repository = container.resolve(INodeRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, node_repository.reset)
agent_event_repository = container.resolve(IAgentEventRepository)
island_event_queue.subscribe(
IslandEventTopic.CLEAR_SIMULATION_DATA, agent_event_repository.reset
)
agent_repository = container.resolve(IAgentRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, agent_repository.reset)
machine_repository = container.resolve(IMachineRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, machine_repository.reset)