Skip to content

Commit

Permalink
[xauth] redfish update (#668)
Browse files Browse the repository at this point in the history
 Reverted rst changes
  • Loading branch information
jagadeeshnv authored May 23, 2024
1 parent adb6f6d commit 6ed1483
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/module_utils/redfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def invoke_request(self, method, path, data=None, query_param=None, headers=None

def __enter__(self):
"""Creates sessions by passing it to header"""
if self.req_session:
if self.req_session and not self.x_auth_token:
payload = {'UserName': self.username,
'Password': self.password}
path = SESSION_RESOURCE_COLLECTION["SESSION"]
Expand All @@ -204,6 +204,8 @@ def __enter__(self):
else:
msg = "Could not create the session"
raise ConnectionError(msg)
elif self.x_auth_token is not None:
self._headers["X-Auth-Token"] = self.x_auth_token
return self

def __exit__(self, exc_type, exc_value, traceback):
Expand Down

0 comments on commit 6ed1483

Please sign in to comment.