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: v19.1.0~384^2~115 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7c602947e45ceff719c105b0277a10a6e72831e5;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 --- diff --git a/src/cephadm/node-proxy/redfish_system.py b/src/cephadm/node-proxy/redfish_system.py index e4a59320768c9..de80d83d87d05 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