forked from p15670423/monkey
Island: Register instances of INodeRepository, IMachineRepository, IAgentRepository in DI container
This commit is contained in:
parent
e674f3ab24
commit
51a9bad000
|
@ -24,13 +24,19 @@ from monkey_island.cc.repository import (
|
||||||
IAgentBinaryRepository,
|
IAgentBinaryRepository,
|
||||||
IAgentConfigurationRepository,
|
IAgentConfigurationRepository,
|
||||||
IAgentEventRepository,
|
IAgentEventRepository,
|
||||||
|
IAgentRepository,
|
||||||
ICredentialsRepository,
|
ICredentialsRepository,
|
||||||
IFileRepository,
|
IFileRepository,
|
||||||
|
IMachineRepository,
|
||||||
|
INodeRepository,
|
||||||
ISimulationRepository,
|
ISimulationRepository,
|
||||||
IUserRepository,
|
IUserRepository,
|
||||||
JSONFileUserRepository,
|
JSONFileUserRepository,
|
||||||
LocalStorageFileRepository,
|
LocalStorageFileRepository,
|
||||||
|
MongoAgentRepository,
|
||||||
MongoCredentialsRepository,
|
MongoCredentialsRepository,
|
||||||
|
MongoMachineRepository,
|
||||||
|
MongoNodeRepository,
|
||||||
RetrievalError,
|
RetrievalError,
|
||||||
StubbedEventRepository,
|
StubbedEventRepository,
|
||||||
)
|
)
|
||||||
|
@ -104,6 +110,10 @@ def _register_repositories(container: DIContainer, data_dir: Path):
|
||||||
# TODO: Replace with MongoEventRepository
|
# TODO: Replace with MongoEventRepository
|
||||||
container.register_instance(IAgentEventRepository, StubbedEventRepository())
|
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:
|
def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository:
|
||||||
return FileRepositoryLockingDecorator(
|
return FileRepositoryLockingDecorator(
|
||||||
|
|
Loading…
Reference in New Issue