]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
node-proxy: fix RedFishClient.logout() method 56165/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 13 Mar 2024 13:32:59 +0000 (13:32 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 13 Mar 2024 13:32:59 +0000 (13:32 +0000)
the endpoint passed down to util.query() is wrong:
is passes the full url (scheme://addr:port/path) where it should only
pass the path. The cause is that RedFishClient.login() basically stores
the value of the Location header in `self.location`.

The consequence of this is that it makes the client unable to properly logout.

Fixes: https://tracker.ceph.com/issues/64894
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
src/ceph-node-proxy/ceph_node_proxy/redfish_client.py

index 08ee4170dcc6aca8939ed0c1b3fbfae586ccfbe2..d75c3db1e2180551fe073f6787f9822532a06a77 100644 (file)
@@ -43,7 +43,8 @@ class RedFishClient(BaseClient):
                 self.log.error(msg)
                 raise RuntimeError
             self.token = _headers['X-Auth-Token']
-            self.location = _headers['Location']
+            location_endpoint: str = _headers['Location'].split('/', 3)[-1:][0]
+            self.location = f'/{location_endpoint}'
 
     def is_logged_in(self) -> bool:
         self.log.debug(f'Checking token validity for {self.url}')