From b78680f5b0a21387d2d378c51a38748405fa3ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Palancher?= Date: Wed, 13 Nov 2024 11:10:54 +0100 Subject: [PATCH] fix(gateway): use generic requests exceptions Catch generic requests.exceptions.RequestException on information retrieval from agents to avoid AttributeError with more specific exceptions on old versions on Requests library. fix #391 --- CHANGELOG.md | 3 +++ slurmweb/apps/gateway.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 598286af..1f036922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix compatibility issue with Requests >= 2.32.2 (#350). - Return HTTP/404 not found with meaningful error message when requesting unexisting node. +- gateway: catch generic `requests.exceptions.RequestException` when retrieving + information from agents to avoid `AttributeError` with more specific + exceptions on old versions on _Requests_ library (#391). - frontend: Update dependencies to fix CVE-2024-45812 and CVE-2024-45811 (vite), CVE-2024-47068 (rollup). diff --git a/slurmweb/apps/gateway.py b/slurmweb/apps/gateway.py index 1c30aafe..185409dd 100644 --- a/slurmweb/apps/gateway.py +++ b/slurmweb/apps/gateway.py @@ -85,8 +85,7 @@ def agents(self): logger.info("Retrieving info from agent at url %s", url.geturl()) agent = self._agent_info(url.geturl()) except ( - requests.exceptions.ConnectionError, - requests.exceptions.JSONDecodeError, + requests.exceptions.RequestException, SlurmwebAgentError, ) as err: logger.error(