Agent: Accept OperatingSystem instead of str in HTTPIslandAPIClientget_agent_binary()

This commit is contained in:
Shreya Malviya 2022-09-20 18:34:05 +05:30
parent 088e020fee
commit 9b3950e8eb
2 changed files with 4 additions and 3 deletions

View File

@ -34,8 +34,7 @@ class CachingAgentBinaryRepository(IAgentBinaryRepository):
@lru_cache(maxsize=None)
def _download_binary_from_island(self, operating_system: OperatingSystem) -> bytes:
os_name = operating_system.value
try:
return self._island_api_client.get_agent_binary(os_name)
return self._island_api_client.get_agent_binary(operating_system)
except IslandAPIError as err:
raise RetrievalError(err)

View File

@ -3,6 +3,7 @@ import logging
import requests
from common import OperatingSystem
from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT, MEDIUM_REQUEST_TIMEOUT
from . import (
@ -78,7 +79,8 @@ class HTTPIslandAPIClient(IIslandAPIClient):
return response.content
@handle_island_errors
def get_agent_binary(self, os_name: str):
def get_agent_binary(self, operating_system: OperatingSystem):
os_name = operating_system.value
response = requests.get( # noqa: DUO123
f"{self._api_url}/agent-binaries/{os_name}",
verify=False,