Skip to content

Fix KeyError for Enclosure Chassis without PCIe devs#206

Open
dev-zero wants to merge 1 commit intoDMTF:mainfrom
dev-zero:bugfix/empty-chassisenclosure
Open

Fix KeyError for Enclosure Chassis without PCIe devs#206
dev-zero wants to merge 1 commit intoDMTF:mainfrom
dev-zero:bugfix/empty-chassisenclosure

Conversation

@dev-zero
Copy link

@dev-zero dev-zero commented Mar 9, 2026

No description provided.

@mraineri
Copy link
Contributor

@dev-zero do you have sample payloads for what brought this out exactly?

Could you also sign-off your commit?

@dev-zero
Copy link
Author

@mraineri sure.

This is the error:

$ uv run scripts/rf_sys_inventory.py --debug
'@odata.id'

This is the relevant part of the log file:

Body Response of /redfish/v1/Chassis/enclosurechassis:
{
    "@odata.context": "/redfish/v1/$metadata#Chassis.Chassis",
    "@odata.etag": "W/\"BB99DD5C\"",
    "@odata.id": "/redfish/v1/Chassis/enclosurechassis",
    "@odata.type": "#Chassis.v1_11_2.Chassis",
    "Id": "enclosurechassis",
    "AssetTag": "",
    "ChassisType": "Enclosure",
    "Manufacturer": "HPE",
    "Name": "HPE Apollo2000 Gen10+  ",
    "Oem": {
        "Hpe": {
            "@odata.context": "/redfish/v1/$metadata#HpeServerChassis.HpeServerChassis",
            "@odata.type": "#HpeServerChassis.v2_3_1.HpeServerChassis",
            "ChassisACPowerWatts": 1223,
            "ChassisPowerWatts": 1169,
            "EnclosureCPLD": "0c0c",
            "IPv4Address": "",
            "NodePowerWatts": 249,
            "TrayID": "0x04"
        }
    },
    "PCIeDevices": {},
    "PCIeSlots": {},
    "PartNumber": "P19878-B21",
    "PowerState": "On",
    "SerialNumber": "CZ212308V3"
}

2026-03-19 12:00:48,586 - redfish - ERROR - Caught exception:

Traceback (most recent call last):
  File "/Users/muellert/Projects/ideas/inventory-via-redfish/Redfish-Tacklebox/scripts/rf_sys_inventory.py", line 78, in <module>
    inventory = redfish_utilities.get_system_inventory(redfish_obj)
  File "/Users/muellert/Projects/ideas/inventory-via-redfish/Redfish-Tacklebox/redfish_utilities/inventory.py", line 80, in get_system_inventory
    catalog_resource(context, chassis.dict, inventory_list, chassis_id)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/muellert/Projects/ideas/inventory-via-redfish/Redfish-Tacklebox/redfish_utilities/inventory.py", line 158, in catalog_resource
    catalog_collection(context, resource, "PCIeDevices", inventory, chassis_id)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/muellert/Projects/ideas/inventory-via-redfish/Redfish-Tacklebox/redfish_utilities/inventory.py", line 126, in catalog_collection
    collection = context.get(resource[name]["@odata.id"])
                             ~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: '@odata.id'

Signed-off-by: Tiziano Müller <tiziano.mueller@hpe.com>
@dev-zero dev-zero force-pushed the bugfix/empty-chassisenclosure branch from 593402a to 5265a00 Compare March 19, 2026 11:05
@mraineri
Copy link
Contributor

mraineri commented Mar 20, 2026

This is actually a bug in the service; having an empty reference object like that is illegal per Redfish. This would not pass conformance testing.

Have you raised this bug with HPE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants