From: Guillaume Abrioux Date: Wed, 5 Apr 2023 12:14:40 +0000 (+0200) Subject: node-proxy: logout from redfish api on Exception X-Git-Tag: v18.2.4~314^2~116 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b104cc57d2aa5f7cd35ca155b660a3f4ff304f20;p=ceph.git node-proxy: logout from redfish api on Exception Otherwise it ends up recreating new session each time whereas the previous session is left. After multiple failures, it reaches the limit and left sessions need to be cleaned up manually. Signed-off-by: Guillaume Abrioux (cherry picked from commit 7c602947e45ceff719c105b0277a10a6e72831e5) --- diff --git a/src/cephadm/node-proxy/redfish_system.py b/src/cephadm/node-proxy/redfish_system.py index e4a59320768c..de80d83d87d0 100644 --- a/src/cephadm/node-proxy/redfish_system.py +++ b/src/cephadm/node-proxy/redfish_system.py @@ -91,12 +91,18 @@ class RedfishSystem(System): def update(self): # this loop can have: # - caching logic - while self.run: - self._update_system() - # following calls in theory can be done in parallel - self._update_metadata() - self._update_memory() - self._update_power() - self._update_network() - self._update_storage() - sleep(3) + try: + while self.run: + self._update_system() + # following calls in theory can be done in parallel + self._update_metadata() + self._update_memory() + self._update_power() + self._update_network() + self._update_storage() + sleep(3) + # Catching 'Exception' is probably not a good idea (devel only) + except Exception: + log.error(f"Error detected, logging out from redfish api") + self.client.logout() + raise