bmcweb icon indicating copy to clipboard operation
bmcweb copied to clipboard

BMC web PATCH for AccountService MinPasswordLength and "MaxPasswordLength" response error message

Open gkeishin opened this issue 5 years ago • 3 comments

}-bash-4.2$ curl -k -H "X-Auth-Token: $bmc_token" -X  GET https://${bmc}/redfish/v1/AccountService
{
  "@odata.context": "/redfish/v1/$metadata#AccountService.AccountService",
  "@odata.id": "/redfish/v1/AccountService",
  "@odata.type": "#AccountService.v1_1_0.AccountService",
  "AccountLockoutDuration": 0,
  "AccountLockoutThreshold": 0,
  "Accounts": {
    "@odata.id": "/redfish/v1/AccountService/Accounts"
  },
  "Description": "Account Service",
  "Id": "AccountService",
  "MaxPasswordLength": 31,
  "MinPasswordLength": 8,
  "Name": "Account Service",
  "Roles": {
    "@odata.id": "/redfish/v1/AccountService/Roles"
  },
  "ServiceEnabled": true
}

Update MinPasswordLength

}-bash-4.2$ curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${bmc}/redfish/v1/AccountService -d '{"MinPasswordLength": 10}'
{
  "[email protected]": [
    {
      "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
      "Message": "The property MinPasswordLength is not in the list of valid properties for the resource.",
      "MessageArgs": [
        "MinPasswordLength"
      ],
      "MessageId": "Base.1.4.0.PropertyUnknown",
      "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed.",
      "Severity": "Warning"
    }
  ]
}-

Update MaxPasswordLength

}-bash-4.2$ curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${bmc}/redfish/v1/AccountService -d '{"MaxPasswordLength": 10}'
{
  "[email protected]": [
    {
      "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
      "Message": "The property MaxPasswordLength is not in the list of valid properties for the resource.",
      "MessageArgs": [
        "MaxPasswordLength"
      ],
      "MessageId": "Base.1.4.0.PropertyUnknown",
      "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed.",
      "Severity": "Warning"
    }
  ]
}

gkeishin avatar Mar 04 '19 07:03 gkeishin

@gkeishin Seems in redfish account service schema, these properties are readonly that's why we are not supporting the PATCH operation.

MaxPasswordLength description "The maximum password length for this service." longDescription "This property shall reference the maximum password length that the implementation will allow a password to be set to." minimum 0 readonly true >>>>>>>>>> >>>>>>>>>>>>>>>>> type "integer" MinPasswordLength description "The minimum password length for this service." longDescription "This property shall reference the minimum password length that the implementation will allow a password to be set to." minimum 0 readonly true >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> type

However I agree that error messages should be corrected saying that these are the read only property, would push a commit for the same.

ratagupt avatar Mar 04 '19 07:03 ratagupt

Fair enough, so the expectation is correct.. @ratagupt , let me know when the code to update the response is ready.. Thanks

MaxPasswordLength number readonly
This is the maximum password length for
this service.

MinPasswordLength number readonly
This is the minimum password length for
this service.

gkeishin avatar Mar 04 '19 07:03 gkeishin

While we could do something better here, like responding with read-only, the response isn't necessarily incorrect. I'm going to mark this as an enhancement, and if someone wants to go update the readJson call to pull those parameters out, and return the correct error codes, they're more than welcome, but given that it's a failure mode, and it gives a pretty reasonable error message, this isn't high on my personal list.

edtanous avatar Mar 04 '19 18:03 edtanous

No comments in 4 years. Closing. Feel free to reopen if anyone is working on this.

edtanous avatar Mar 27 '23 17:03 edtanous