Skip to content

Commit

Permalink
providers/redfish: move DeviceVendorModel helper method into redfishw…
Browse files Browse the repository at this point in the history
…rapper
  • Loading branch information
joelrebel committed Nov 7, 2023
1 parent a02f582 commit 68c905d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion providers/redfish/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func updateParametersFormField(fieldName string, writer *multipart.Writer) (io.W

// FirmwareInstallStatus returns the status of the firmware install task queued
func (c *Conn) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (state string, err error) {
vendor, _, err := c.DeviceVendorModel(ctx)
vendor, _, err := c.redfishwrapper.DeviceVendorModel(ctx)
if err != nil {
return state, errors.Wrap(err, "unable to determine device vendor, model attributes")
}
Expand Down
16 changes: 0 additions & 16 deletions providers/redfish/redfish.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,7 @@ func (c *Conn) Compatible(ctx context.Context) bool {
return err == nil
}

// DeviceVendorModel returns the device manufacturer and model attributes
func (c *Conn) DeviceVendorModel(ctx context.Context) (vendor, model string, err error) {
systems, err := c.redfishwrapper.Systems()
if err != nil {
return "", "", err
}

for _, sys := range systems {
if !compatibleOdataID(sys.ODataID, systemsOdataIDs) {
continue
}

return sys.Manufacturer, sys.Model, nil
}

return vendor, model, bmclibErrs.ErrRedfishSystemOdataID
}

// BmcReset power cycles the BMC
func (c *Conn) BmcReset(ctx context.Context, resetType string) (ok bool, err error) {
Expand Down
4 changes: 2 additions & 2 deletions providers/redfish/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *Conn) activeTask(ctx context.Context) (*gofishrf.Task, error) {

// GetFirmwareInstallTaskQueued returns the redfish task object for a queued update task
func (c *Conn) GetFirmwareInstallTaskQueued(ctx context.Context, component string) (*gofishrf.Task, error) {
vendor, _, err := c.DeviceVendorModel(ctx)
vendor, _, err := c.redfishwrapper.DeviceVendorModel(ctx)
if err != nil {
return nil, errors.Wrap(err, "unable to determine device vendor, model attributes")
}
Expand All @@ -101,7 +101,7 @@ func (c *Conn) GetFirmwareInstallTaskQueued(ctx context.Context, component strin

// purgeQueuedFirmwareInstallTask removes any existing queued firmware install task for the given component slug
func (c *Conn) purgeQueuedFirmwareInstallTask(ctx context.Context, component string) error {
vendor, _, err := c.DeviceVendorModel(ctx)
vendor, _, err := c.redfishwrapper.DeviceVendorModel(ctx)
if err != nil {
return errors.Wrap(err, "unable to determine device vendor, model attributes")
}
Expand Down

0 comments on commit 68c905d

Please sign in to comment.