xlab-steampunk / redfish-client-python

Minimalistic Redfish API client
Apache License 2.0
4 stars 8 forks source link

Firmware upgrade fails on pre-5.x iDRAC firmware #34

Closed jkugler closed 2 years ago

jkugler commented 2 years ago

Trying to call this:

        res = self.rf_root.UpdateService.execute_action(
            "#UpdateService.SimpleUpdate",
            dict(ImageURI=image_uri)
        )

on iDRAC 4.x firmware results in this error:

{
    "error": {
        "@Message.ExtendedInfo": [
            {
                "Message": "InstanceID value provided for the update operation is invalid",
                "MessageArgs": [],
                "MessageArgs@odata.count": 0,
                "MessageId": "IDRAC.2.2.SUP024",
                "RelatedProperties": [],
                "RelatedProperties@odata.count": 0,
                "Resolution": "Enumerate inventory, copy the InstanceID value and provide that value for the update operation.",
                "Severity": "Warning"
            }
        ],
        "code": "Base.1.5.GeneralError",
        "message": "A general error has occurred. See ExtendedInfo for more information"
    }
}

However, this works against a 4.x firmware without issue:

>>> import requests
>>> from requests.auth import HTTPBasicAuth
>>> r = requests.post('https://BMC_IP/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate',
    json={"ImageURI": "http://FILE_SHARE_IP/firmware/dell/PowerEdge_R440/BMC/iDRAC-with-Lifecycle-Controller_Firmware_F87RP_WN64_5.00.00.00_A00.EXE"},
    verify=False,
    auth=HTTPBasicAuth('root', '<password>'))
>>> r.headers
{'Date': 'Tue, 09 Aug 2022 00:21:42 GMT', 'Server': 'Apache', 'OData-Version': '4.0', 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'no-cache', 'X-Frame-Options': 'DENY', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Location': '/redfish/v1/TaskService/Tasks/JID_600045028912', 'Content-Length': '0', 'Keep-Alive': 'timeout=60, max=100', 'Connection': 'Keep-Alive', 'Content-Type': 'application/json;odata.metadata=minimal;charset=utf-8'}

Even if the "OData-Version": "4.0" header is added, it still works. I'm not sure what else redfish-client is adding/removing from the request.

jkugler commented 2 years ago

This fails for both BIOS and BMC firmware upgrade attempts.

jkugler commented 2 years ago

Found the cause. Existing code, for some reason, removed the http:// on the firmware URL. Apparently 5.x iDRAC didn't care about that, but 4.x did.