Island: Create class variable for agent config schema in new configuration resource

This commit is contained in:
Shreya Malviya 2022-06-21 15:55:39 -07:00
parent 6b45d62d81
commit 922495785c
1 changed files with 2 additions and 2 deletions

View File

@ -32,6 +32,7 @@ class AgentConfiguration(AbstractResource):
def __init__(self, agent_configuration_repository: IAgentConfigurationRepository): def __init__(self, agent_configuration_repository: IAgentConfigurationRepository):
self._agent_configuration_repository = agent_configuration_repository self._agent_configuration_repository = agent_configuration_repository
self._schema = AgentConfigurationSchema()
@jwt_required @jwt_required
def get(self): def get(self):
@ -45,8 +46,7 @@ class AgentConfiguration(AbstractResource):
AgentConfiguration._remove_metadata_from_config(configuration_json) AgentConfiguration._remove_metadata_from_config(configuration_json)
try: try:
schema = AgentConfigurationSchema() configuration_object = self._schema.loads(configuration_json)
configuration_object = schema.loads(configuration_json)
self._agent_configuration_repository.store_configuration(configuration_object) self._agent_configuration_repository.store_configuration(configuration_object)
return ResponseContents().form_response() return ResponseContents().form_response()
except marshmallow.exceptions.ValidationError: except marshmallow.exceptions.ValidationError: