Add support for customizing Manager attributes

This commit is contained in:
Joshua Boniface 2022-07-06 16:36:33 +00:00
parent 7d92dae744
commit f263885790
1 changed files with 16 additions and 1 deletions

View File

@ -720,9 +720,12 @@ def redfish_init(config, cspec, data):
redfish_name = redfish_base_detail["Name"] redfish_name = redfish_base_detail["Name"]
redfish_version = redfish_base_detail["RedfishVersion"] redfish_version = redfish_base_detail["RedfishVersion"]
managers_base_root = redfish_base_detail["Managers"]["@odata.id"].rstrip("/")
managers_base_detail = session.get(managers_base_root)
manager_root = managers_base_detail["Members"][0]["@odata.id"].rstrip("/")
systems_base_root = redfish_base_detail["Systems"]["@odata.id"].rstrip("/") systems_base_root = redfish_base_detail["Systems"]["@odata.id"].rstrip("/")
systems_base_detail = session.get(systems_base_root) systems_base_detail = session.get(systems_base_root)
system_root = systems_base_detail["Members"][0]["@odata.id"].rstrip("/") system_root = systems_base_detail["Members"][0]["@odata.id"].rstrip("/")
# Force off the system and turn on the indicator # Force off the system and turn on the indicator
@ -823,6 +826,18 @@ def redfish_init(config, cspec, data):
payload = {"Attributes": {setting: value}} payload = {"Attributes": {setting: value}}
session.patch(f"{bios_root}/Settings", payload) session.patch(f"{bios_root}/Settings", payload)
# Adjust any Manager settings
logger.info("Adjusting Manager settings...")
mgrattribute_root = f"{manager_root}/Attributes"
mgrattribute_detail = session.get(mgrattribute_root)
mgrattribute_attributes = list(mgrattribute_detail["Attributes"].keys())
for setting, value in cspec_node["bmc"].get("manager_settings", {}).items():
if setting not in bios_attributes:
continue
payload = {"Attributes": {setting: value}}
session.patch(mgrattribute_root, payload)
# Set boot override to Pxe for the installer boot # Set boot override to Pxe for the installer boot
logger.info("Setting temporary PXE boot...") logger.info("Setting temporary PXE boot...")
set_boot_override(session, system_root, redfish_vendor, "Pxe") set_boot_override(session, system_root, redfish_vendor, "Pxe")