Island, BB: Fix credential conversion to dict bugs

This commit is contained in:
vakaris_zilius 2022-09-06 11:51:16 +00:00
parent e5574240e9
commit 472ca382f1
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import json
import logging
import time
from typing import Sequence, Union
from typing import List, Sequence, Union
from bson import json_util
@ -59,9 +59,9 @@ class MonkeyIslandClient(object):
assert False
@avoid_race_condition
def _import_credentials(self, propagation_credentials: Credentials):
def _import_credentials(self, propagation_credentials: List[Credentials]):
serialized_propagation_credentials = [
Credentials.dict(credentials) for credentials in propagation_credentials
credentials.dict() for credentials in propagation_credentials
]
response = self.requests.put_json(
"/api/propagation-credentials/configured-credentials",

View File

@ -68,7 +68,7 @@ class MongoCredentialsRepository(ICredentialsRepository):
def _save_credentials_to_collection(self, credentials: Sequence[Credentials], collection):
try:
for c in credentials:
encrypted_credentials = self._encrypt_credentials_mapping(c.dict())
encrypted_credentials = self._encrypt_credentials_mapping(c.dict(simplify=True))
collection.insert_one(encrypted_credentials)
except Exception as err:
raise StorageError(err)