forked from p15670423/monkey
Island: Create class variable for agent config schema in new configuration resource
This commit is contained in:
parent
6b45d62d81
commit
922495785c
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue