From 19a59bf3c272ad3dc720b9947da73ea001ed5545 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Fri, 16 Sep 2022 12:27:08 +0530 Subject: [PATCH] Agent: Use AgentEventSerializerRegistry in place of EventSerializerRegistry --- monkey/infection_monkey/agent_event_forwarder.py | 4 ++-- monkey/infection_monkey/monkey.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/monkey/infection_monkey/agent_event_forwarder.py b/monkey/infection_monkey/agent_event_forwarder.py index cb4f8bdda..c0a731fcf 100644 --- a/monkey/infection_monkey/agent_event_forwarder.py +++ b/monkey/infection_monkey/agent_event_forwarder.py @@ -6,7 +6,7 @@ from time import sleep import requests from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT -from common.event_serializers import EventSerializerRegistry, JSONSerializable +from common.event_serializers import AgentEventSerializerRegistry, JSONSerializable from common.events import AbstractAgentEvent from infection_monkey.utils.threading import create_daemon_thread @@ -23,7 +23,7 @@ class AgentEventForwarder: """ def __init__( - self, server_address: str, agent_event_serializer_registry: EventSerializerRegistry + self, server_address: str, agent_event_serializer_registry: AgentEventSerializerRegistry ): self._server_address = server_address self._agent_event_serializer_registry = agent_event_serializer_registry diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index dfc34bec2..ccc03adf9 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -11,7 +11,7 @@ from pubsub.core import Publisher from common.event_queue import IAgentEventQueue, PyPubSubAgentEventQueue from common.event_serializers import ( - EventSerializerRegistry, + AgentEventSerializerRegistry, register_common_agent_event_serializers, ) from common.events import CredentialsStolenEvent @@ -213,8 +213,8 @@ class InfectionMonkey: register_signal_handlers(self._master) # TODO: This is just a placeholder for now. We will modify/integrate it with PR #2279. - def _setup_agent_event_serializers(self) -> EventSerializerRegistry: - agent_event_serializer_registry = EventSerializerRegistry() + def _setup_agent_event_serializers(self) -> AgentEventSerializerRegistry: + agent_event_serializer_registry = AgentEventSerializerRegistry() register_common_agent_event_serializers(agent_event_serializer_registry) return agent_event_serializer_registry @@ -259,7 +259,7 @@ class InfectionMonkey: event_queue: IAgentEventQueue, propagation_credentials_repository: IPropagationCredentialsRepository, server_address: str, - agent_event_serializer_registry: EventSerializerRegistry, + agent_event_serializer_registry: AgentEventSerializerRegistry, ): event_queue.subscribe_type( CredentialsStolenEvent,