Skip to content

Commit

Permalink
Merge pull request #388 from bmc-toolbox/supported-check
Browse files Browse the repository at this point in the history
Supported check
  • Loading branch information
joelrebel authored Apr 18, 2024
2 parents aa42442 + 1753bef commit 8f1f0db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions providers/asrockrack/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const (

// bmc client interface implementations methods
func (a *ASRockRack) FirmwareInstallSteps(ctx context.Context, component string) ([]constants.FirmwareInstallStep, error) {
if err := a.supported(ctx); err != nil {
return nil, bmclibErrs.NewErrUnsupportedHardware(err.Error())
}

switch strings.ToUpper(component) {
case common.SlugBMC:
return []constants.FirmwareInstallStep{
Expand Down
10 changes: 3 additions & 7 deletions providers/dell/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ import (
"github.com/stmcginnis/gofish/redfish"
)

var (
ErrUnsupportedHardware = errors.New("hardware not supported")
)

// bmc client interface implementations methods
func (c *Conn) FirmwareInstallSteps(ctx context.Context, component string) ([]constants.FirmwareInstallStep, error) {
if err := c.deviceSupported(ctx); err != nil {
return nil, errors.Wrap(ErrUnsupportedHardware, err.Error())
return nil, bmcliberrs.NewErrUnsupportedHardware(err.Error())
}

return []constants.FirmwareInstallStep{
Expand All @@ -35,7 +31,7 @@ func (c *Conn) FirmwareInstallSteps(ctx context.Context, component string) ([]co

func (c *Conn) FirmwareInstallUploadAndInitiate(ctx context.Context, component string, file *os.File) (taskID string, err error) {
if err := c.deviceSupported(ctx); err != nil {
return "", errors.Wrap(ErrUnsupportedHardware, err.Error())
return "", bmcliberrs.NewErrUnsupportedHardware(err.Error())
}

// // expect atleast 5 minutes left in the deadline to proceed with the upload
Expand Down Expand Up @@ -102,7 +98,7 @@ func (c *Conn) checkQueueability(component string, tasks []*redfish.Task) error
// FirmwareTaskStatus returns the status of a firmware related task queued on the BMC.
func (c *Conn) FirmwareTaskStatus(ctx context.Context, kind constants.FirmwareInstallStep, component, taskID, installVersion string) (state constants.TaskState, status string, err error) {
if err := c.deviceSupported(ctx); err != nil {
return "", "", errors.Wrap(ErrUnsupportedHardware, err.Error())
return "", "", bmcliberrs.NewErrUnsupportedHardware(err.Error())
}

// Dell jobs are turned into Redfish tasks on the idrac
Expand Down

0 comments on commit 8f1f0db

Please sign in to comment.