File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/ceph-node-proxy/ceph_node_proxy Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ def login(self) -> None:
3030 oob_credentials = json .dumps ({'UserName' : self .username ,
3131 'Password' : self .password })
3232 headers = {'Content-Type' : 'application/json' }
33+ location_endpoint : str = ''
3334
3435 try :
3536 _headers , _data , _status_code = self .query (data = oob_credentials ,
@@ -43,8 +44,14 @@ def login(self) -> None:
4344 self .log .error (msg )
4445 raise RuntimeError
4546 self .token = _headers ['X-Auth-Token' ]
46- location_endpoint : str = _headers ['Location' ].split ('/' , 3 )[- 1 :][0 ]
47- self .location = f'/{ location_endpoint } '
47+ if _headers ['Location' ].startswith ('http' ):
48+ # We assume the value has the following format:
49+ # scheme://address:port/redfish/v1/SessionService/Session
50+ location_endpoint = f"/{ _headers ['Location' ].split ('/' , 3 )[- 1 :][0 ]} "
51+ else :
52+ location_endpoint = _headers ['Location' ]
53+ self .location = location_endpoint
54+ self .log .info (f'Logged in to { self .url } , Received header "Location": { self .location } ' )
4855
4956 def is_logged_in (self ) -> bool :
5057 self .log .debug (f'Checking token validity for { self .url } ' )
You can’t perform that action at this time.
0 commit comments