Skip to content

Commit

Permalink
Merge pull request #374 from redhat-performance/development
Browse files Browse the repository at this point in the history
* fix: removed problematic call from boot_to()
  • Loading branch information
sadsfae authored Aug 15, 2023
2 parents a62e7e8 + 9725a8b commit c9e0b2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ venv.bak/

# SCP Exports folder (Testing purpose)
tests/exports/
exports/
15 changes: 9 additions & 6 deletions src/badfish/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async def get_bios_attribute_registry(self, attribute):
data = await self.get_bios_attributes_registry()
attribute_value = await self.get_bios_attribute(attribute)
for entry in data["RegistryEntries"]["Attributes"]:
entries = [low_entry.lower() for low_entry in entry.values() if type(low_entry) == str]
entries = [low_entry.lower() for low_entry in entry.values() if isinstance(low_entry, str)]
if attribute.lower() in entries:
for values in entry.items():
if values[0] == "CurrentValue":
Expand Down Expand Up @@ -300,15 +300,15 @@ async def get_bios_attribute(self, attribute):
try:
bios_attribute = data["Attributes"][attribute]
return bios_attribute
except KeyError:
except (KeyError, TypeError):
self.logger.warning("Could not retrieve Bios Attributes.")
return None

async def set_bios_attribute(self, attributes):
data = await self.get_bios_attributes_registry()
accepted = False
for entry in data["RegistryEntries"]["Attributes"]:
entries = [low_entry.lower() for low_entry in entry.values() if type(low_entry) == str]
entries = [low_entry.lower() for low_entry in entry.values() if isinstance(low_entry, str)]
_warnings = []
_not_found = []
_remove = []
Expand Down Expand Up @@ -1073,7 +1073,6 @@ async def boot_to(self, device):
if device_check:
await self.clear_job_queue()
await self.send_one_time_boot(device)
await self.create_bios_config_job(self.bios_uri)
else:
return False
return True
Expand Down Expand Up @@ -1297,14 +1296,18 @@ async def get_virtual_media_config(self):
if self.vendor == "Supermicro":
try:
vm_path = {
"config": data["Oem"].get("Supermicro").get("VirtualMediaConfig").get("@odata.id"),
"config": "",
"count": data["[email protected]"],
"members": [],
}
if data["Oem"].get("Supermicro"):
vm_path.update({"config": data["Oem"].get("Supermicro").get("VirtualMediaConfig").get("@odata.id")})
else:
vm_path.update({"config": data["Oem"].get("VirtualMediaConfig").get("@odata.id")})
if vm_path["count"] > 0:
for m in data["Members"]:
vm_path["members"].append(m.get("@odata.id"))
except (ValueError, KeyError):
except (ValueError, KeyError, TypeError):
raise BadfishException("Not able to access virtual media config.")
else:
try:
Expand Down
2 changes: 0 additions & 2 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ def render_device_dict(index, device):
"- INFO - iDRAC will now reset and be back online within a few minutes.\n"
"- INFO - Polling for host state: On\n"
"- INFO - Command passed to set BIOS attribute pending values.\n"
"- ERROR - POST command failed to create BIOS config job, status code is 400.\n"
"- ERROR - {'JobID': 'JID_498218641680'}\n"
)
RESPONSE_BOOT_TO_SERVICE_ERR_HANDLER = (
f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n"
Expand Down

0 comments on commit c9e0b2b

Please sign in to comment.