Skip to content
Merged
Show file tree
Hide file tree
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
138 changes: 70 additions & 68 deletions config/idrac_interfaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,88 @@
# Also see /opt/quads/quads/config.py SUPPORTED list if adding system types.
#
---
director_b01_fc640_interfaces: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b02_fc640_interfaces: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b03_fc640_interfaces: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b04_fc640_interfaces: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r630_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
director_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r650_interfaces: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r660_interfaces: NIC.PxeDevice.2-1,RAID.SL.3-2,NIC.PxeDevice.1-1
director_r720xd_interfaces: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r730xd_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_740xd_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
director_r740xd_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_7425_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
director_7525_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
director_r930_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
foreman_b01_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.8-1-1
foreman_b02_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.4-1-1
foreman_b03_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.6-1-1
foreman_b04_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.2-1-1
foreman_r630_interfaces: NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
foreman_r650_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
foreman_r660_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2,NIC.PxeDevice.2-1
foreman_r720xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
foreman_r730xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_740xd_interfaces: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r740xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
foreman_r750_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
foreman_7425_interfaces: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1
foreman_7525_interfaces: NIC.Embedded.1-1-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
foreman_r930_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
director_b01_fc640: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b02_fc640: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b03_fc640: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_b04_fc640: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r630: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
director_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r650: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_r660: NIC.PxeDevice.2-1,RAID.SL.3-2,NIC.PxeDevice.1-1
director_r720xd: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r730xd: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_740xd: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
director_r740xd: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
director_7425: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
director_7525: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
director_r930: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
foreman_b01_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.8-1-1
foreman_b02_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.4-1-1
foreman_b03_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.6-1-1
foreman_b04_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.2-1-1
foreman_r630: NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
foreman_r650: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
foreman_r660: NIC.PxeDevice.1-1,RAID.SL.3-2,NIC.PxeDevice.2-1
foreman_r720xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
foreman_r730xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_740xd: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r740xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
foreman_r750: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
foreman_7425: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1
foreman_7525: NIC.Embedded.1-1-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
foreman_r930: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
# These are for EFI
# Expanding rest of models as a workaround for issue #239
uefi_r630_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
uefi_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
uefi_b01_fc640_interfaces: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b02_fc640_interfaces: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b03_fc640_interfaces: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b04_fc640_interfaces: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_r650_interfaces: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_r630: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
uefi_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
uefi_b01_fc640: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b02_fc640: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b03_fc640: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_b04_fc640: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_r650: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
# Here we should be able to distinguish between 'foreman' and 'director'
# interface layouts.
uefi_r720xd_interfaces: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_r730xd_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_740xd_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
uefi_r740xd_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_7425_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
uefi_7525_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
uefi_r930_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_mx750c_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
uefi_r720xd: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_r730xd: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_740xd: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
uefi_r740xd: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
uefi_7425: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
uefi_7525: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
uefi_r930: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
uefi_mx750c: NIC.PxeDevice.1-1,RAID.SL.3-2

# To understand how custom overrides and hierarchy work please see https://github.com/redhat-performance/badfish#host-type-overrides
# PerfLab Entries
foreman_cc37_r750_interfaces: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
director_cc37_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
foreman_bb37_r750_interfaces: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
director_bb37_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
foreman_r760_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
director_r760_interfaces: RAID.SL.3-2,NIC.PxeDevice.1-1
foreman_mx750c_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
director_mx750c_interfaces: RAID.SL.3-2,NIC.PxeDevice.1-1
foreman_cc37_r750: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
director_cc37_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
foreman_bb37_r750: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
director_bb37_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
foreman_r760: NIC.PxeDevice.1-1,RAID.SL.3-2
director_r760: RAID.SL.3-2,NIC.PxeDevice.1-1
foreman_mx750c: NIC.PxeDevice.1-1,RAID.SL.3-2
director_mx750c: RAID.SL.3-2,NIC.PxeDevice.1-1

# Custom Rack F04
director_f18_r640_interfaces: NIC.Slot.3-2,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Integrated.1-1-1
foreman_f18_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.3-2,NIC.Slot.2-1,NIC.Slot.2-2
director_f18_r640: NIC.Slot.3-2,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Integrated.1-1-1
foreman_f18_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.3-2,NIC.Slot.2-1,NIC.Slot.2-2

# Custom Rack E27 and E28 for Dell R750
director_e27_r750_interfaces: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
director_e28_r750_interfaces: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
foreman_e27_r750_interfaces: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
foreman_e28_r750_interfaces: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
uefi_e27_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
uefi_e28_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
director_e27_r750: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
director_e28_r750: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
foreman_e27_r750: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
foreman_e28_r750: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
uefi_e27_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
uefi_e28_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1

## Custom F04 specific overrides (examples)
## h34 (should resemble other r640 hosts)
# director_f04_h34_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
# foreman_f04_h34_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
# director_f04_h34_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
# foreman_f04_h34_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
# h35 (should resemble other r640 hosts)
# director_f04_h35_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
# foreman_f04_h35_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
# director_f04_h35_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
# foreman_f04_h35_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1

custom: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
45 changes: 42 additions & 3 deletions src/badfish/helpers/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,52 @@
try:
if self.host:
host_name = self.host.strip().split(".")[0]
new_dict = yaml.safe_load(self.messages[host_name])
# Ensure the message is properly formatted as YAML by wrapping values in quotes
message = self.messages[host_name]

Check warning on line 57 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L57

Added line #L57 was not covered by tests
# Try to parse as is first
try:
new_dict = yaml.safe_load(message)
except yaml.YAMLError:

Check warning on line 61 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L59-L61

Added lines #L59 - L61 were not covered by tests
# If parsing fails, try to format the value as a quoted string
lines = message.strip().split('\n')
formatted_lines = []
for line in lines:
if ':' in line:
key, value = line.split(':', 1)
value = value.strip()

Check warning on line 68 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L63-L68

Added lines #L63 - L68 were not covered by tests
# If value contains spaces or special characters, wrap in quotes
if ' ' in value or any(c in value for c in '{}[](),:#'):
value = f'"{value}"'
formatted_lines.append(f"{key}: {value}")

Check warning on line 72 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L70-L72

Added lines #L70 - L72 were not covered by tests
else:
formatted_lines.append(line)
formatted_message = '\n'.join(formatted_lines)
new_dict = yaml.safe_load(formatted_message)

Check warning on line 76 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L74-L76

Added lines #L74 - L76 were not covered by tests

self.output_dict.update({self.host: new_dict.copy()})
self.host = None
else:
new_dict = yaml.safe_load(self.messages["badfish.helpers.logger"])
message = self.messages["badfish.helpers.logger"]

Check warning on line 81 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L81

Added line #L81 was not covered by tests
# Apply the same formatting logic for non-host messages
try:
new_dict = yaml.safe_load(message)
except yaml.YAMLError:
lines = message.strip().split('\n')
formatted_lines = []
for line in lines:
if ':' in line:
key, value = line.split(':', 1)
value = value.strip()
if ' ' in value or any(c in value for c in '{}[](),:#'):
value = f'"{value}"'
formatted_lines.append(f"{key}: {value}")

Check warning on line 94 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L83-L94

Added lines #L83 - L94 were not covered by tests
else:
formatted_lines.append(line)
formatted_message = '\n'.join(formatted_lines)
new_dict = yaml.safe_load(formatted_message)

Check warning on line 98 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L96-L98

Added lines #L96 - L98 were not covered by tests

self.output_dict.update(new_dict.copy())
except yaml.YAMLError:
except yaml.YAMLError as ex:

Check warning on line 101 in src/badfish/helpers/logger.py

View check run for this annotation

Codecov / codecov/patch

src/badfish/helpers/logger.py#L101

Added line #L101 was not covered by tests
self.output_dict = {"unsupported_command": True}

def diff(self):
Expand Down
35 changes: 23 additions & 12 deletions src/badfish/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,26 +211,34 @@ async def get_interfaces_by_type(self, host_type, _interfaces_path):
definitions = await self.read_yaml(_interfaces_path)

host_name_split = self.host.split(".")[0].split("-")
host_model = host_name_split[-1]
rack = host_name_split[1]
uloc = host_name_split[2]
host_model = None
rack = None
uloc = None
host_blade = None
prefix = [host_type]
if len(host_name_split) > 1:
host_model = host_name_split[-1]
rack = host_name_split[1]
uloc = host_name_split[2]
prefix.extend([rack, uloc])

host_blade = "000"
if len(host_name_split) > 4:
host_blade = host_name_split[3]
prefix.append(host_blade)

prefix = [host_type, rack, uloc, host_blade]

key = f"{host_type}_{host_blade}_{host_model}_interfaces"
interfaces_string = definitions.get(key)
if interfaces_string:
return interfaces_string.split(",")
if host_blade:
key = f"{host_type}_{host_blade}_{host_model}"
interfaces_string = definitions.get(key)
if interfaces_string:
return interfaces_string.split(",")

len_prefix = len(prefix)
key = "None"
for _ in range(len_prefix):
prefix_string = "_".join(prefix)
key = "%s_%s_interfaces" % (prefix_string, host_model)
key = prefix_string
if host_model:
key = "_".join([prefix_string, host_model])
interfaces_string = definitions.get(key)
if interfaces_string:
return interfaces_string.split(",")
Expand Down Expand Up @@ -451,7 +459,10 @@ async def get_host_type(self, _interfaces_path):
host_types = await self.get_host_types_from_yaml(_interfaces_path)
for host_type in host_types:
match = True
interfaces = await self.get_interfaces_by_type(host_type, _interfaces_path)
try:
interfaces = await self.get_interfaces_by_type(host_type, _interfaces_path)
except BadfishException as e:
continue

for device in sorted(self.boot_devices[: len(interfaces)], key=lambda x: x["Index"]):
if device["Name"] == interfaces[device["Index"]]:
Expand Down
8 changes: 6 additions & 2 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def render_device_dict(index, device):
f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n"
"- INFO - Command passed to set BIOS attribute pending values.\n"
)
RESPONSE_BOOT_TO_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['director', 'foreman', 'uefi']\n"
RESPONSE_BOOT_TO_CUSTOM = (
f"- WARNING - Job queue already cleared for iDRAC host01.example.com, DELETE command will not execute.\n"
"- INFO - Command passed to set BIOS attribute pending values.\n"
)
RESPONSE_BOOT_TO_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['custom', 'director', 'foreman', 'uefi']\n"
RESPONSE_BOOT_TO_SERVICE_UNAVAILABLE = (
f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n"
"- ERROR - Command failed, error code is: 503.\n"
Expand Down Expand Up @@ -216,7 +220,7 @@ def render_device_dict(index, device):
"- INFO - Polling for host state: Not Down\n"
"- INFO - Command passed to On server, code return is 200.\n"
)
RESPONSE_CHANGE_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['director', 'foreman', 'uefi']\n"
RESPONSE_CHANGE_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['custom', 'director', 'foreman', 'uefi']\n"
RESPONSE_CHANGE_TO_SAME = "- WARNING - No changes were made since the boot order already matches the requested.\n"
RESPONSE_CHANGE_NO_INT = "- ERROR - You must provide a path to the interfaces yaml via `-i` optional argument.\n"

Expand Down
Loading