Skip to content

Commit

Permalink
Move readall before uploadFW
Browse files Browse the repository at this point in the history
  • Loading branch information
ofaurax committed Nov 10, 2023
1 parent a89b2a7 commit 1ff6687
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions providers/asrockrack/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ func (a *ASRockRack) FirmwareInstallStatus(ctx context.Context, installVersion,
func (a *ASRockRack) firmwareInstallBMC(ctx context.Context, reader io.Reader, fileSize int64) error {
var err error

mybytes, err := io.ReadAll(reader)
fmt.Printf("ReadAll reader len:%d\n", len(mybytes))

// 0. take the model so that we use a different endpoint on E3C256D4ID-NL
device := common.NewDevice()
device.Metadata = map[string]string{}
Expand All @@ -93,6 +90,10 @@ func (a *ASRockRack) firmwareInstallBMC(ctx context.Context, reader io.Reader, f
if strings.EqualFold(device.Model, "E3C256D4ID-NL") {
fwEndpoint = "api/maintenance/firmware/firmware"
}

mybytes, err := io.ReadAll(reader)

Check failure on line 94 in providers/asrockrack/firmware.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
fmt.Printf("ReadAll reader before uploadFW len:%d\n", len(mybytes))

a.log.V(2).WithValues("step", "2/4").Info("upload BMC firmware image to " + fwEndpoint)
err = a.uploadFirmware(ctx, fwEndpoint, reader, fileSize)
if err != nil {
Expand Down

0 comments on commit 1ff6687

Please sign in to comment.