From 433e154cd1415952b2b7ba2433704b2701d3a213 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Mon, 29 Aug 2022 19:42:04 +0530 Subject: [PATCH] Island: Modify AgentConfiguration endpoint to use new pydantic model --- monkey/monkey_island/cc/resources/agent_configuration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/resources/agent_configuration.py b/monkey/monkey_island/cc/resources/agent_configuration.py index 6db3f8b63..e96ed5df2 100644 --- a/monkey/monkey_island/cc/resources/agent_configuration.py +++ b/monkey/monkey_island/cc/resources/agent_configuration.py @@ -20,13 +20,13 @@ class AgentConfiguration(AbstractResource): # Used by the agent. Can't secure def get(self): configuration = self._agent_configuration_repository.get_configuration() - configuration_json = AgentConfigurationObject.to_json(configuration) - return make_response(configuration_json, 200) + configuration_dict = configuration.dict() + return make_response(configuration_dict, 200) @jwt_required def put(self): try: - configuration_object = AgentConfigurationObject.from_mapping(request.json) + configuration_object = AgentConfigurationObject(**request.json) self._agent_configuration_repository.store_configuration(configuration_object) # API Spec: Should return 204 (NO CONTENT) return make_response({}, 200)