stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 112 forks source link

fix manager reset action when no allowed values for reset type are provided #279

Closed vsvastey closed 11 months ago

vsvastey commented 11 months ago

Sometimes Manager.Reset action doesn't provide AllowableValues for ResetTypes, like that:

  "Actions": {
    "#Manager.Reset": {
      "target": "/redfish/v1/Managers/1/Actions/Manager.Reset/"
    }
  }

In this case current implementation provides a payload {"Action": "Manager.Reset"} which doesn't work at least for HP gen9 (iLO4) that I can test on. I get Base.0.10.ActionNotSupported error.

According to the specification:

    Manager_v1_18_0_ResetRequestBody:
        ....
        ResetType:
          ...
          x-longDescription: This parameter shall contain the type of reset.  The
            service can accept a request without the parameter and perform an implementation
            specific default reset.  Services should include the @Redfish.AllowableValues
            annotation for this parameter to ensure compatibility with clients, even
            when ActionInfo has been implemented.
         ...

it seems like an empty payload should be sent in this case.

I've tested an empty payload on HP gen9 and it works as expected.

Please, consider the fix for this case.

stmcginnis commented 11 months ago

Looks reasonable to me. @leslie-qiwa originally added this special handling for HPE awhile back. Let's just wait a bit to see if they want to chime in here or confirm from their environment.

leslie-qiwa commented 11 months ago

I can not find such a server in our system now. The change looks good for me. You can go ahead merging, and I'll let you know if the issue comes up.