Agent: Modify ControlChannel to use AgentConfiguration endpoint

This commit is contained in:
Ilija Lazoroski 2022-06-24 20:00:39 +02:00 committed by Mike Salvatore
parent 98a9fd3285
commit b564e71d89
1 changed files with 2 additions and 3 deletions

View File

@ -52,17 +52,16 @@ class ControlChannel(IControlChannel):
def get_config(self) -> AgentConfiguration: def get_config(self) -> AgentConfiguration:
try: try:
response = requests.get( # noqa: DUO123 response = requests.get( # noqa: DUO123
f"https://{self._control_channel_server}/api/agent", f"https://{self._control_channel_server}/api/agent-configuration",
verify=False, verify=False,
proxies=self._proxies, proxies=self._proxies,
timeout=SHORT_REQUEST_TIMEOUT, timeout=SHORT_REQUEST_TIMEOUT,
) )
response.raise_for_status() response.raise_for_status()
config_dict = json.loads(response.text)["config"]
logger.debug(f"Received configuration:\n{pformat(json.loads(response.text))}") logger.debug(f"Received configuration:\n{pformat(json.loads(response.text))}")
return AgentConfiguration.from_mapping(config_dict) return AgentConfiguration.from_json(response.text)
except ( except (
json.JSONDecodeError, json.JSONDecodeError,
requests.exceptions.ConnectionError, requests.exceptions.ConnectionError,