BB: Modify IslandConfigParser to return serialized config

This commit is contained in:
Shreya Malviya 2022-07-21 11:53:29 +05:30 committed by Mike Salvatore
parent f99ad90371
commit d5736df56d
1 changed files with 4 additions and 7 deletions

View File

@ -3,20 +3,17 @@ import json
import dpath.util
from typing_extensions import Type
from common.configuration.agent_configuration import AgentConfiguration
from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate
from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient
class IslandConfigParser:
@staticmethod
def get_raw_config(
config_template: Type[ConfigTemplate], island_client: MonkeyIslandClient
def get_serialized_config(
agent_configuration: AgentConfiguration, island_client: MonkeyIslandClient
) -> str:
response = island_client.get_config()
config = IslandConfigParser.apply_template_to_config(
config_template, response["configuration"]
)
return json.dumps(config)
return agent_configuration.to_json()
@staticmethod
def apply_template_to_config(config_template: Type[ConfigTemplate], config: dict) -> dict: