Skip to content

Commit

Permalink
providers/redfish/tasks: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ofaurax committed Sep 22, 2023
1 parent 4f017f8 commit 2e453c6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions providers/redfish/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *Conn) activeTask(ctx context.Context) (*gofishrf.Task, error) {

err = json.Unmarshal(data, &status)
if err != nil {
fmt.Println(err)
return nil, err
}

// For each task, check if it's running
Expand Down Expand Up @@ -122,7 +122,6 @@ func (c *Conn) purgeQueuedFirmwareInstallTask(ctx context.Context, component str

// GetTask returns the current Task fir the given TaskID
func (c *Conn) GetTask(taskID string) (task *gofishrf.Task, err error) {

resp, err := c.redfishwrapper.Get("/redfish/v1/TaskService/Tasks/" + taskID)
if err != nil {
if err.Error()[0:3] == "404" {
Expand All @@ -148,12 +147,12 @@ func (c *Conn) GetTask(taskID string) (task *gofishrf.Task, err error) {

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

task = &gofishrf.Task{
TaskState: gofishrf.TaskState(status.TaskState),
TaskStatus: gofishcommon.Health(status.TaskStatus),
}

return task, err
Expand Down

0 comments on commit 2e453c6

Please sign in to comment.