Skip to content

Commit

Permalink
Merge branch 'main' into tests-concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius authored Dec 2, 2024
2 parents e70edad + 51adf5d commit 43e47f8
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async def get_server(self, name: str) -> _SessionType | None:
except NotFoundError:
return None
except ServerError as err:
if err.status not in [400, 404]:
if err.response is None or err.response.status_code not in [400, 404]:
logging.exception(f"Cannot get server {name} because of {err}")
raise IntermittentError(f"Cannot get server {name} from the k8s API.")
return None
Expand All @@ -193,16 +193,11 @@ async def list_servers(self, label_selector: Optional[str] = None) -> list[_Sess
try:
servers = await self._kr8s_type.list(namespace=self.namespace, label_selector=label_selector)
except ServerError as err:
if err.status not in [400, 404]:
if err.response is None or err.response.status_code not in [400, 404]:
logging.exception(f"Cannot list servers because of {err}")
raise IntermittentError(f"Cannot list servers from the k8s API with selector {label_selector}.")
return []
output: list[_SessionType]
if isinstance(servers, APIObject):
output = [self.server_type.model_validate(servers.to_dict())]
else:
output = [self.server_type.model_validate(server.to_dict()) for server in servers]

output: list[_SessionType] = [self.server_type.model_validate(server.to_dict()) for server in servers]
return output

async def patch_image_pull_secret(self, server_name: str, gitlab_token: GitlabToken) -> None:
Expand Down

0 comments on commit 43e47f8

Please sign in to comment.