Skip to content

Commit

Permalink
internal/redfishwrapper/firmware.go: If body parses into redfish.Task…
Browse files Browse the repository at this point in the history
…, then pull TaskID from there directly
  • Loading branch information
splaspood committed Sep 18, 2024
1 parent 3d1fe09 commit 7b556a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/redfishwrapper/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/bmc-toolbox/bmclib/v2/constants"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
redfish "github.com/stmcginnis/gofish/redfish"
)

type installMethod string
Expand Down Expand Up @@ -99,6 +100,14 @@ func (c *Client) FirmwareUpload(ctx context.Context, updateFile *os.File, params
)
}

// For X13 the full Task structure is returned in the body. If we can Unmarshall then we can safely assume
// that redfishTask.ID contains the ID.
redfishTask := &redfish.Task{}
err = json.Unmarshal(response, redfishTask)
if err == nil {
return redfishTask.ID, nil
}

// The response contains a location header pointing to the task URI
// Location: /redfish/v1/TaskService/Tasks/JID_467696020275
var location = resp.Header.Get("Location")
Expand Down

0 comments on commit 7b556a4

Please sign in to comment.