Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/badfish/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,16 @@ async def get_host_type(self, _interfaces_path):

async def find_session_uri(self):
_response = await self.get_request(self.root_uri, _get_token=True)
raw = await _response.text("utf-8", "ignore")
data = json.loads(raw.strip())

status = _response.status
if status == 401:
raise BadfishException(f"Failed to authenticate. Verify your credentials for {self.host}")
if status not in [200, 201]:
raise BadfishException(f"Failed to communicate with {self.host}")

raw = await _response.text("utf-8", "ignore")
data = json.loads(raw.strip())

redfish_version = int(data["RedfishVersion"].replace(".", ""))
session_uri = None
if redfish_version >= 160:
Expand Down
Loading