Island: Rename local event_queue -> island_event_queue

Disambiguate Island event queues from Agent event queues
This commit is contained in:
Mike Salvatore 2022-09-12 14:21:06 -04:00 committed by Ilija Lazoroski
parent 6d297dc201
commit 4e49e59447
1 changed files with 10 additions and 8 deletions

View File

@ -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
)