From 922495785c19f3624a15a608f8fb3ddf13aa0fc0 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 21 Jun 2022 15:55:39 -0700 Subject: [PATCH] Island: Create class variable for agent config schema in new configuration resource --- monkey/monkey_island/cc/resources/configuration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/resources/configuration.py b/monkey/monkey_island/cc/resources/configuration.py index 2ed567561..5ec163ded 100644 --- a/monkey/monkey_island/cc/resources/configuration.py +++ b/monkey/monkey_island/cc/resources/configuration.py @@ -32,6 +32,7 @@ class AgentConfiguration(AbstractResource): def __init__(self, agent_configuration_repository: IAgentConfigurationRepository): self._agent_configuration_repository = agent_configuration_repository + self._schema = AgentConfigurationSchema() @jwt_required def get(self): @@ -45,8 +46,7 @@ class AgentConfiguration(AbstractResource): AgentConfiguration._remove_metadata_from_config(configuration_json) try: - schema = AgentConfigurationSchema() - configuration_object = schema.loads(configuration_json) + configuration_object = self._schema.loads(configuration_json) self._agent_configuration_repository.store_configuration(configuration_object) return ResponseContents().form_response() except marshmallow.exceptions.ValidationError: