From ccb0337aef8c32a2278259e81c72ad7eefd92e74 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 28 Mar 2022 21:15:57 +0200 Subject: [PATCH] Agent: Add return to get credentials method in Credentials Store --- .../credential_store/aggregating_credentials_store.py | 1 + .../infection_monkey/credential_store/i_credentials_store.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/credential_store/aggregating_credentials_store.py b/monkey/infection_monkey/credential_store/aggregating_credentials_store.py index d855b98dd..31c0a156a 100644 --- a/monkey/infection_monkey/credential_store/aggregating_credentials_store.py +++ b/monkey/infection_monkey/credential_store/aggregating_credentials_store.py @@ -41,6 +41,7 @@ class AggregatingCredentialsStore(ICredentialsStore): try: propagation_credentials = self._control_channel.get_credentials_for_propagation() self._aggregate_credentials(propagation_credentials) + return self.stored_credentials except Exception as ex: self.stored_credentials = {} logger.error(f"Error while attempting to retrieve credentials for propagation: {ex}") diff --git a/monkey/infection_monkey/credential_store/i_credentials_store.py b/monkey/infection_monkey/credential_store/i_credentials_store.py index 2ac10192b..17387480d 100644 --- a/monkey/infection_monkey/credential_store/i_credentials_store.py +++ b/monkey/infection_monkey/credential_store/i_credentials_store.py @@ -1,5 +1,5 @@ import abc -from typing import Iterable +from typing import Iterable, Mapping from infection_monkey.i_puppet import Credentials @@ -13,7 +13,7 @@ class ICredentialsStore(metaclass=abc.ABCMeta): """ @abc.abstractmethod - def get_credentials(self) -> None: + def get_credentials(self) -> Mapping: """ Method that retrieves credentials from the store :return: Credentials that can be used for propagation