diff --git a/providers/asrockrack/firmware.go b/providers/asrockrack/firmware.go index 23c099d9..f5d80ccf 100644 --- a/providers/asrockrack/firmware.go +++ b/providers/asrockrack/firmware.go @@ -184,6 +184,13 @@ func (a *ASRockRack) firmwareUpdateStatus(ctx context.Context, component string, switch installStatus { case versionStrMatch: + if progress == nil { + // TODO: we should pass the force parameter to firmwareUpdateStatus, + // so that we can know if we expect a version change or not + a.log.V(3).Info("Nil progress + no version change -> unknown") + return constants.FirmwareInstallUnknown, nil + } + return constants.FirmwareInstallComplete, nil case versionStrEmpty: return constants.FirmwareInstallUnknown, nil diff --git a/providers/asrockrack/helpers.go b/providers/asrockrack/helpers.go index 6496cf49..c7f06532 100644 --- a/providers/asrockrack/helpers.go +++ b/providers/asrockrack/helpers.go @@ -226,6 +226,11 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead fieldName, fileName := "fwimage", "image" contentLength := multipartSize(fieldName, fileName) + fileSize + // Before reading the file, rewind to the beginning + if file, ok := fwReader.(*os.File); ok { + _, _ = file.Seek(0, 0) + } + // setup pipe pipeReader, pipeWriter := io.Pipe() defer pipeReader.Close()