Skip to content

Commit

Permalink
Use correct type for multipartHTTP update
Browse files Browse the repository at this point in the history
  • Loading branch information
ofaurax committed Sep 13, 2023
1 parent a9eae65 commit 9f2672e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions providers/redfish/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *Conn) FirmwareInstall(ctx context.Context, component, applyAt string, f
switch installMethod {
case multipartHttpUpload:
var uploadErr error
resp, uploadErr = c.multipartHTTPUpload(ctx, installURI, applyAt, reader)
resp, uploadErr = c.multipartHTTPUpload(ctx, installURI, applyAt, updateFile)
if uploadErr != nil {
return "", errors.Wrap(bmclibErrs.ErrFirmwareInstall, uploadErr.Error())

Check warning on line 110 in providers/redfish/firmware.go

View check run for this annotation

Codecov / codecov/patch

providers/redfish/firmware.go#L110

Added line #L110 was not covered by tests
}
Expand Down Expand Up @@ -160,7 +160,7 @@ type multipartPayload struct {
updateFile *os.File
}

func (c *Conn) multipartHTTPUpload(ctx context.Context, url, applyAt string, update io.Reader) (*http.Response, error) {
func (c *Conn) multipartHTTPUpload(ctx context.Context, url, applyAt string, update *os.File) (*http.Response, error) {
if url == "" {
return nil, fmt.Errorf("unable to execute request, no target provided")

Check warning on line 165 in providers/redfish/firmware.go

View check run for this annotation

Codecov / codecov/patch

providers/redfish/firmware.go#L165

Added line #L165 was not covered by tests
}
Expand All @@ -180,9 +180,9 @@ func (c *Conn) multipartHTTPUpload(ctx context.Context, url, applyAt string, upd
}

// payload ordered in the format it ends up in the multipart form
payload := []map[string]io.Reader{
{"UpdateParameters": bytes.NewReader(parameters)},
{"UpdateFile": update},
payload := &multipartPayload{
updateParameters: []byte(parameters),
updateFile: update,
}

return c.runRequestWithMultipartPayload(url, payload)
Expand Down

0 comments on commit 9f2672e

Please sign in to comment.