diff --git a/monkey/monkey_island/cc/setup/island_event_handlers.py b/monkey/monkey_island/cc/setup/island_event_handlers.py index ba7fb9f30..a4935fabd 100644 --- a/monkey/monkey_island/cc/setup/island_event_handlers.py +++ b/monkey/monkey_island/cc/setup/island_event_handlers.py @@ -8,25 +8,27 @@ from monkey_island.cc.services.database import Database def setup_island_event_handlers(container: DIContainer): - event_queue = container.resolve(IIslandEventQueue) + island_event_queue = container.resolve(IIslandEventQueue) - _handle_reset_agent_configuration_events(event_queue, container) - _handle_clear_simulation_data_events(event_queue, container) + _handle_reset_agent_configuration_events(island_event_queue, container) + _handle_clear_simulation_data_events(island_event_queue, container) def _handle_reset_agent_configuration_events( - event_queue: IIslandEventQueue, container: DIContainer + island_event_queue: IIslandEventQueue, container: DIContainer ): - event_queue.subscribe( + island_event_queue.subscribe( IslandEventTopic.RESET_AGENT_CONFIGURATION, container.resolve(reset_agent_configuration) ) -def _handle_clear_simulation_data_events(event_queue: IIslandEventQueue, container: DIContainer): +def _handle_clear_simulation_data_events( + island_event_queue: IIslandEventQueue, container: DIContainer +): legacy_database_reset = partial(Database.reset_db, reset_config=False) - event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, legacy_database_reset) + island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, legacy_database_reset) credentials_repository = container.resolve(ICredentialsRepository) - event_queue.subscribe( + island_event_queue.subscribe( IslandEventTopic.CLEAR_SIMULATION_DATA, credentials_repository.remove_stolen_credentials )