From a8a25845a658bd8299f2924c0b8e3b6f893ee808 Mon Sep 17 00:00:00 2001 From: Doctor Vince Date: Thu, 19 Sep 2024 14:40:08 -0400 Subject: [PATCH] port to gofish/redfish v0.19.0 --- go.mod | 2 +- go.sum | 6 ++---- internal/redfishwrapper/firmware.go | 11 +++++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 855d5ba3..256f980f 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.31.0 github.com/sirupsen/logrus v1.9.3 - github.com/stmcginnis/gofish v0.15.1-0.20231121142100-22a60a77be91 + github.com/stmcginnis/gofish v0.19.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 diff --git a/go.sum b/go.sum index c6c8301e..58a0ef34 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/VictorLowther/simplexml v0.0.0-20180716164440-0bff93621230 h1:t95Grn2 github.com/VictorLowther/simplexml v0.0.0-20180716164440-0bff93621230/go.mod h1:t2EzW1qybnPDQ3LR/GgeF0GOzHUXT5IVMLP2gkW1cmc= github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22 h1:a0MBqYm44o0NcthLKCljZHe1mxlN6oahCQHHThnSwB4= github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22/go.mod h1:/B7V22rcz4860iDqstGvia/2+IYWXf3/JdQCVd/1D2A= -github.com/bmc-toolbox/common v0.0.0-20240805193945-ce25765471a7 h1:+NcnInwZxn25daBCb3d1y3x9QF23uob1ghdiimj2Dwo= -github.com/bmc-toolbox/common v0.0.0-20240805193945-ce25765471a7/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I= github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3 h1:/BjZSX/sphptIdxpYo4wxAQkgMLyMMgfdl48J9DKNeE= github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM= @@ -61,8 +59,8 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/stmcginnis/gofish v0.15.1-0.20231121142100-22a60a77be91 h1:WmABtU8y6kTgzoVUn3FWCQGAfyodve3uz3xno28BrRs= -github.com/stmcginnis/gofish v0.15.1-0.20231121142100-22a60a77be91/go.mod h1:BLDSFTp8pDlf/xDbLZa+F7f7eW0E/CHCboggsu8CznI= +github.com/stmcginnis/gofish v0.19.0 h1:fmxdRZ5WHfs+4ExArMYoeRfoh+SAxLELKtmoVplBkU4= +github.com/stmcginnis/gofish v0.19.0/go.mod h1:lq2jHj2t8Krg0Gx02ABk8MbK7Dz9jvWpO/TGnVksn00= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/internal/redfishwrapper/firmware.go b/internal/redfishwrapper/firmware.go index 08ac4976..81c3f1a5 100644 --- a/internal/redfishwrapper/firmware.go +++ b/internal/redfishwrapper/firmware.go @@ -28,6 +28,12 @@ const ( multipartHttpUpload installMethod = "multipartUpload" ) +var ( + // the URI for starting a firmware update via StartUpdate is defined in the Redfish Resource and + // Schema Guide (2024.1) + startUpdateURI = "redfish/v1/UpdateService/Actions/UpdateService.StartUpdate" +) + var ( errMultiPartPayload = errors.New("error preparing multipart payload") errUpdateParams = errors.New("error in redfish UpdateParameters payload") @@ -117,8 +123,9 @@ func (c *Client) StartUpdateForUploadedFirmware(ctx context.Context) (taskID str return "", errors.Wrap(err, "error querying redfish update service") } - // start update - resp, err := updateService.GetClient().PostWithHeaders(updateService.StartUpdateTarget, nil, nil) + // Start update the hard way. We do this to get back the task object from the response body so that + // we can parse the task id out of it. + resp, err := updateService.GetClient().PostWithHeaders(startUpdateURI, nil, nil) if err != nil { return "", errors.Wrap(err, "error querying redfish start update endpoint") }