From 51a9bad0008fcb3e2c56897121aeb316a93ee16e Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 20 Sep 2022 15:48:07 +0530 Subject: [PATCH] Island: Register instances of INodeRepository, IMachineRepository, IAgentRepository in DI container --- monkey/monkey_island/cc/services/initialize.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index df4f92d6b..695db13c7 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -24,13 +24,19 @@ from monkey_island.cc.repository import ( IAgentBinaryRepository, IAgentConfigurationRepository, IAgentEventRepository, + IAgentRepository, ICredentialsRepository, IFileRepository, + IMachineRepository, + INodeRepository, ISimulationRepository, IUserRepository, JSONFileUserRepository, LocalStorageFileRepository, + MongoAgentRepository, MongoCredentialsRepository, + MongoMachineRepository, + MongoNodeRepository, RetrievalError, StubbedEventRepository, ) @@ -104,6 +110,10 @@ def _register_repositories(container: DIContainer, data_dir: Path): # TODO: Replace with MongoEventRepository container.register_instance(IAgentEventRepository, StubbedEventRepository()) + container.register_instance(INodeRepository, container.resolve(MongoNodeRepository)) + container.register_instance(IMachineRepository, container.resolve(MongoMachineRepository)) + container.register_instance(IAgentRepository, container.resolve(MongoAgentRepository)) + def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository: return FileRepositoryLockingDecorator(