Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redfish provider to support unstructured http push uploads #346

Merged
merged 16 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
providers/redfish/tasks: add a function to get current task status fo…
…r OpenBMC
ofaurax committed Sep 14, 2023
commit 1cb7fb9fe85a5d2bb9bfe9be5a8f3c434cba2834
24 changes: 24 additions & 0 deletions providers/redfish/tasks.go
Original file line number Diff line number Diff line change
@@ -2,12 +2,14 @@ package redfish

import (
"context"
"encoding/json"
"fmt"
"strings"

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

@@ -70,3 +72,25 @@ func (c *Conn) purgeQueuedFirmwareInstallTask(ctx context.Context, component str

return err
}

func (c *Conn) openbmcGetTask(jsonstr []byte) (task *gofishrf.Task, err error) {

type TaskStatus struct {
TaskState string
TaskStatus string
}

var status TaskStatus

err = json.Unmarshal(jsonstr, &status)
if err != nil {
fmt.Println(err)
} else {
task = &gofishrf.Task{
TaskState: gofishrf.TaskState(status.TaskState),
TaskStatus: gofishcommon.Health(status.TaskStatus),
}
}

return task, err
}