forked from p15670423/monkey
BB: Modify IslandConfigParser to return serialized config
This commit is contained in:
parent
f99ad90371
commit
d5736df56d
|
@ -3,20 +3,17 @@ import json
|
||||||
import dpath.util
|
import dpath.util
|
||||||
from typing_extensions import Type
|
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.config_templates.config_template import ConfigTemplate
|
||||||
from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient
|
from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient
|
||||||
|
|
||||||
|
|
||||||
class IslandConfigParser:
|
class IslandConfigParser:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_raw_config(
|
def get_serialized_config(
|
||||||
config_template: Type[ConfigTemplate], island_client: MonkeyIslandClient
|
agent_configuration: AgentConfiguration, island_client: MonkeyIslandClient
|
||||||
) -> str:
|
) -> str:
|
||||||
response = island_client.get_config()
|
return agent_configuration.to_json()
|
||||||
config = IslandConfigParser.apply_template_to_config(
|
|
||||||
config_template, response["configuration"]
|
|
||||||
)
|
|
||||||
return json.dumps(config)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def apply_template_to_config(config_template: Type[ConfigTemplate], config: dict) -> dict:
|
def apply_template_to_config(config_template: Type[ConfigTemplate], config: dict) -> dict:
|
||||||
|
|
Loading…
Reference in New Issue