dell / terraform-provider-redfish

Terraform provider for Redfish REST APIs
https://registry.terraform.io/providers/dell/redfish/latest
Mozilla Public License 2.0
95 stars 21 forks source link

redfish_idrac_firmware_update: fails after initial apply #232

Open dkaser opened 3 months ago

dkaser commented 3 months ago

Terraform CLI and Terraform Redfish Provider Version

Terraform 1.9.5 Redfish Provider Version 1.4.0

Server(s) details and firmware version

Dell R760

iDRAC 9 BIOS Version 2.2.8 Firmware Version 7.10.50.10

Affected Resource(s)

resource "redfish_idrac_firmware_update"

Expected Behavior

The documentation for redfish_idrac_firmware_update directs to have the firmware catalog applied on every run. On the initial apply run, the firmware updates should be applied to the server. On subsequent runs, firmware updates should be applied if the catalog has changed; otherwise, the module should finish successfully.

Actual Behavior

If the catalog has not changed since the last apply, the module fails with an error:

redfish_idrac_firmware_update.update["name"]: Still creating... [10s elapsed]
╷
│ Error: install service error
│
│   with redfish_idrac_firmware_update.update["name"],
│   on firmware.tf line 1, in resource "redfish_idrac_firmware_update" "update":
│    1: resource "redfish_idrac_firmware_update" "update" {
│
│ 400: {"error":{"@Message.ExtendedInfo":[{"Message":"Unable to complete the operation because the catalog name entered has either unsupported firmware packages or same version installed on the
│ server.","MessageArgs":[],"MessageArgs@odata.count":0,"MessageId":"IDRAC.2.9.SUP029","RelatedProperties":[],"RelatedProperties@odata.count":0,"Resolution":"Make sure a valid catalog is used which has
│ applicable and supported Windows Update Packages in the repository.","Severity":"Warning"}],"code":"Base.1.12.GeneralError","message":"A general error has occurred. See ExtendedInfo for more
│ information"}}
╵

Steps to Reproduce

  1. terraform apply
gokul-srivathsan commented 3 months ago

Thanks @dkaser . we are looking into this. Will get back to you soon.

anupamaloke commented 3 months ago

@dkaser, could you also please share your TF plan?

dkaser commented 3 months ago

@anupamaloke , TF plans contain sensitive data, so I can't share that here.

gokul-srivathsan commented 2 months ago

@dkaser , May I know the update versions of Firmware ('From' and 'To' version)? Are you updating to '7.10.50.10'?

tanh17 commented 2 months ago

@dkaser , My test environment is the following, I met the same 400 error when I upgrade to the same firmware version 7.00.00.00. I think it is the expectation. The error prompt the upgrade package is invalid or the same so that the upgrade process couldn't been applied. @gokul-srivathsan , what's your thought? Dell R640 iDRAC 9 BIOS Version 2.21.2 Firmware Version 7.00.00.00

tanh17 commented 2 months ago

@dkaser I tested two scenarios for firmware update resource, which scenario did you make? Scenario 1:

  1. Execute terraform apply to upgrade to firmware 7.0. (Apply success and check firmware has been upgraded to 7.0 in UI)
  2. Continue to apply(catalog is not changed). The result is that terraform shows no change. This scenario couldn't find the issue you said.

Scenario 2:

  1. Check the current terraform state is empty.
  2. catalog_file_name set to the same version which is consistent with current version in UI. And apply_update and reboot_needed set to true.
  3. Execute apply.
  4. we will get the same error message.
gokul-srivathsan commented 2 months ago

@dkaser your reply would be much helpful.

dkaser commented 1 month ago

I think the issue that I was having was related to the order that the updates installed in.... it was doing the iDRAC update last, which then caused the apply to fail when the iDRAC reset.

On the subsequent applies, there were no firmware updates to apply, and so the update failed because there was nothing to do.

I ended up abandoning redfish_idrac_firmware_update and writing my own logic using simple_update and count to select the updates to apply.