diff --git a/bmc/bios.go b/bmc/bios.go index 87da3eb7..d578abe2 100644 --- a/bmc/bios.go +++ b/bmc/bios.go @@ -210,7 +210,7 @@ func SetBiosConfigurationFromFileInterfaces(ctx context.Context, generic []inter temp.BiosConfigurationSetter = p implementations = append(implementations, temp) default: - e := fmt.Sprintf("not a BiosConfigurationSetter implementation: %T", p) + e := fmt.Sprintf("not a BiosConfigurationSetterFromFile implementation: %T", p) err = multierror.Append(err, errors.New(e)) } } @@ -219,7 +219,7 @@ func SetBiosConfigurationFromFileInterfaces(ctx context.Context, generic []inter err, errors.Wrap( bmclibErrs.ErrProviderImplementation, - ("no BiosConfigurationSetter implementations found"), + ("no BiosConfigurationSetterFromFile implementations found"), ), ) } diff --git a/examples/bios/main.go b/examples/bios/main.go index 5425e68f..f9bc5c1d 100644 --- a/examples/bios/main.go +++ b/examples/bios/main.go @@ -93,29 +93,14 @@ func main() { l.Error(err) } case "setfile": - exampleConfig := make(map[string]string) - - if *dfile != "" { - cfgFile, err := os.Open(*dfile) - if err != nil { - l.Fatal(err) - } - - defer cfgFile.Close() + fmt.Println("Attempting to set BIOS configuration:") - jsonData, _ := io.ReadAll(cfgFile) - err = json.Unmarshal(jsonData, &exampleConfig) - if err != nil { - l.Error(err) - } - } else { - exampleConfig["TpmSecurity"] = "Off" + contents, err := os.ReadFile(*dfile) + if err != nil { + l.Fatal(err) } - fmt.Println("Attempting to set BIOS configuration:") - fmt.Printf("exampleConfig: %+v\n", exampleConfig) - - err := client.SetBiosConfiguration(ctx, exampleConfig) + err = client.SetBiosConfigurationFromFile(ctx, string(contents)) if err != nil { l.Error(err) } @@ -126,6 +111,5 @@ func main() { } default: l.Fatal("Unknown mode: " + *mode) - } } diff --git a/providers/supermicro/supermicro.go b/providers/supermicro/supermicro.go index 6fc9b50a..1259642d 100644 --- a/providers/supermicro/supermicro.go +++ b/providers/supermicro/supermicro.go @@ -270,7 +270,7 @@ func (c *Client) SetBiosConfiguration(ctx context.Context, biosConfig map[string } // SetBiosConfigurationFromFile sets the bios configuration from a raw vendor config file -func (c *Client) SetBIOSConfigurationFromFile(ctx context.Context, cfg string) (err error) { +func (c *Client) SetBiosConfigurationFromFile(ctx context.Context, cfg string) (err error) { if c.serviceClient == nil || c.serviceClient.sum == nil { return errors.Wrap(bmclibErrs.ErrLoginFailed, "client not initialized") }