diff --git a/internal/redfishwrapper/bios.go b/internal/redfishwrapper/bios.go index 0f1750df..3a6e8da2 100644 --- a/internal/redfishwrapper/bios.go +++ b/internal/redfishwrapper/bios.go @@ -61,7 +61,6 @@ func (c *Client) SetBiosConfiguration(ctx context.Context, biosConfig map[string // TODO(jwb) We should handle passing different apply times here err = bios.UpdateBiosAttributesApplyAt(settingsAttributes, common.OnResetApplyTime) - if err != nil { return err } diff --git a/providers/dell/firmware.go b/providers/dell/firmware.go index 220024f2..1c7bfbb3 100644 --- a/providers/dell/firmware.go +++ b/providers/dell/firmware.go @@ -19,7 +19,7 @@ import ( // bmc client interface implementations methods func (c *Conn) FirmwareInstallSteps(ctx context.Context, component string) ([]constants.FirmwareInstallStep, error) { - if err := c.deviceSupported(ctx); err != nil { + if err := c.deviceSupported(); err != nil { return nil, bmcliberrs.NewErrUnsupportedHardware(err.Error()) } @@ -30,7 +30,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 { + if err := c.deviceSupported(); err != nil { return "", bmcliberrs.NewErrUnsupportedHardware(err.Error()) } @@ -97,7 +97,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 { + if err := c.deviceSupported(); err != nil { return "", "", bmcliberrs.NewErrUnsupportedHardware(err.Error()) } diff --git a/providers/dell/idrac.go b/providers/dell/idrac.go index 5df26462..abf82cff 100644 --- a/providers/dell/idrac.go +++ b/providers/dell/idrac.go @@ -45,6 +45,7 @@ var ( providers.FeatureBmcReset, providers.FeatureGetBiosConfiguration, providers.FeatureSetBiosConfiguration, + providers.FeatureSetBiosConfigurationFromFile, providers.FeatureResetBiosConfiguration, } @@ -134,7 +135,7 @@ func (c *Conn) Open(ctx context.Context) (err error) { // because this uses the redfish interface and the redfish interface // is available across various BMC vendors, we verify the device we're connected to is dell. - if err := c.deviceSupported(ctx); err != nil { + if err := c.deviceSupported(); err != nil { if er := c.redfishwrapper.Close(ctx); er != nil { return fmt.Errorf("%v: %w", err, er) } @@ -145,8 +146,8 @@ func (c *Conn) Open(ctx context.Context) (err error) { return nil } -func (c *Conn) deviceSupported(ctx context.Context) error { - manufacturer, err := c.deviceManufacturer(ctx) +func (c *Conn) deviceSupported() error { + manufacturer, err := c.deviceManufacturer() if err != nil { return err } @@ -232,6 +233,17 @@ func (c *Conn) SetBiosConfiguration(ctx context.Context, biosConfig map[string]s return c.redfishwrapper.SetBiosConfiguration(ctx, biosConfig) } +// SetBiosConfigurationFromFile sets the bios configuration from a raw vendor config file +func (c *Conn) SetBiosConfigurationFromFile(ctx context.Context, biosConfg string) (err error) { + configMap := make(map[string]string) + err = json.Unmarshal([]byte(biosConfg), &configMap) + if err != nil { + return errors.Wrap(err, "failed to unmarshal config file") + } + + return c.redfishwrapper.SetBiosConfiguration(ctx, configMap) +} + // ResetBiosConfiguration resets the BIOS configuration settings back to 'factory defaults' via the BMC func (c *Conn) ResetBiosConfiguration(ctx context.Context) (err error) { return c.redfishwrapper.ResetBiosConfiguration(ctx) @@ -243,7 +255,7 @@ func (c *Conn) SendNMI(ctx context.Context) error { } // deviceManufacturer returns the device manufacturer and model attributes -func (c *Conn) deviceManufacturer(ctx context.Context) (vendor string, err error) { +func (c *Conn) deviceManufacturer() (vendor string, err error) { systems, err := c.redfishwrapper.Systems() if err != nil { return "", errors.Wrap(errManufacturerUnknown, err.Error())