From 9f2672eedd42716ac92d442e2e8fea8399a5fb95 Mon Sep 17 00:00:00 2001 From: Olivier FAURAX Date: Wed, 13 Sep 2023 12:59:57 +0200 Subject: [PATCH] Use correct type for multipartHTTP update --- providers/redfish/firmware.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/providers/redfish/firmware.go b/providers/redfish/firmware.go index e7c213c6..0fec520b 100644 --- a/providers/redfish/firmware.go +++ b/providers/redfish/firmware.go @@ -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()) } @@ -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") } @@ -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)