BB: Use to_mapping() to send agent configuration JSON

This commit is contained in:
Mike Salvatore 2022-07-22 12:29:41 -04:00
parent 9d6b0c5a61
commit 2d338fc81f
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from typing import Union
from bson import json_util from bson import json_util
from common.configuration import AgentConfiguration
from envs.monkey_zoo.blackbox.island_client.monkey_island_requests import MonkeyIslandRequests from envs.monkey_zoo.blackbox.island_client.monkey_island_requests import MonkeyIslandRequests
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
@ -33,7 +34,8 @@ class MonkeyIslandClient(object):
@avoid_race_condition @avoid_race_condition
def import_config(self, test_configuration: TestConfiguration): def import_config(self, test_configuration: TestConfiguration):
self.requests.post( self.requests.post(
"api/agent-configuration", data=test_configuration.agent_configuration.to_json() "api/agent-configuration",
data=AgentConfiguration.to_mapping(test_configuration.agent_configuration),
) )
serialized_propagation_credentials = json.dumps( serialized_propagation_credentials = json.dumps(
[credential.to_json() for credential in test_configuration.propagation_credentials] [credential.to_json() for credential in test_configuration.propagation_credentials]