Island: Subscribe legacy Database.reset_db to CLEAR_SIMULATION_DATA

This commit is contained in:
Mike Salvatore 2022-09-12 13:54:29 -04:00 committed by Ilija Lazoroski
parent 9479b56722
commit 6d297dc201
1 changed files with 6 additions and 1 deletions

View File

@ -1,7 +1,10 @@
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.services.database import Database
def setup_island_event_handlers(container: DIContainer):
@ -20,8 +23,10 @@ def _handle_reset_agent_configuration_events(
def _handle_clear_simulation_data_events(event_queue: IIslandEventQueue, container: DIContainer):
credentials_repository = container.resolve(ICredentialsRepository)
legacy_database_reset = partial(Database.reset_db, reset_config=False)
event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, legacy_database_reset)
credentials_repository = container.resolve(ICredentialsRepository)
event_queue.subscribe(
IslandEventTopic.CLEAR_SIMULATION_DATA, credentials_repository.remove_stolen_credentials
)