Skip to content

Commit

Permalink
Add vendorOptions to NewVendorConfigManager for use in config/dell.go…
Browse files Browse the repository at this point in the history
… specifically
  • Loading branch information
splaspood committed Mar 20, 2024
1 parent 878882b commit fffe54a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/asrockrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type asrockrackBiosCfgSetting struct {
Type string `xml:"type,attr"`
}

func NewAsrockrackVendorConfigManager(configFormat string) (VendorConfigManager, error) {
func NewAsrockrackVendorConfigManager(configFormat string, vendorOptions map[string]string) (VendorConfigManager, error) {
asrr := &asrockrackVendorConfig{}

switch strings.ToLower(configFormat) {
Expand Down
8 changes: 5 additions & 3 deletions config/dell.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type dellComponentAttribute struct {
Value string `xml:",chardata" json:"Value"`
}

func NewDellVendorConfigManager(configFormat string) (VendorConfigManager, error) {
func NewDellVendorConfigManager(configFormat string, vendorOptions map[string]string) (VendorConfigManager, error) {
dell := &dellVendorConfig{}

switch strings.ToLower(configFormat) {
Expand All @@ -53,13 +53,15 @@ func NewDellVendorConfigManager(configFormat string) (VendorConfigManager, error
SystemConfiguration: &dellSystemConfiguration{},
}

dell.setSystemConfiguration(vendorOptions["model"], vendorOptions["servicetag"])
return dell, nil

Check failure on line 57 in config/dell.go

View workflow job for this annotation

GitHub Actions / lint

return statements should not be cuddled if block has more than two lines (wsl)

Check failure on line 57 in config/dell.go

View workflow job for this annotation

GitHub Actions / lint

return statements should not be cuddled if block has more than two lines (wsl)
}

func (cm *dellVendorConfig) SetSystemConfiguration(model, servicetag, timestamp string) {
func (cm *dellVendorConfig) setSystemConfiguration(model, servicetag string) {
cm.ConfigData.SystemConfiguration.Model = model
cm.ConfigData.SystemConfiguration.ServiceTag = servicetag
cm.ConfigData.SystemConfiguration.TimeStamp = timestamp
// TODO(jwb) Make this 'now'
cm.ConfigData.SystemConfiguration.TimeStamp = "Tue Nov 2 21:19:16 2021"
}

// FindComponent locates an existing DellComponent if one exists in the ConfigData, if not
Expand Down
8 changes: 4 additions & 4 deletions config/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ type VendorConfigManager interface {
Marshal() (string, error)
}

func NewVendorConfigManager(configFormat, vendorName string) (VendorConfigManager, error) {
func NewVendorConfigManager(configFormat, vendorName string, vendorOptions map[string]string) (VendorConfigManager, error) {
switch strings.ToLower(vendorName) {
case common.VendorDell:
return NewDellVendorConfigManager(configFormat)
return NewDellVendorConfigManager(configFormat, vendorOptions)
case common.VendorSupermicro:
return NewSupermicroVendorConfigManager(configFormat)
return NewSupermicroVendorConfigManager(configFormat, vendorOptions)
case common.VendorAsrockrack:
return NewAsrockrackVendorConfigManager(configFormat)
return NewAsrockrackVendorConfigManager(configFormat, vendorOptions)
default:
return nil, UnknownVendorError(strings.ToLower(vendorName))
}
Expand Down
2 changes: 1 addition & 1 deletion config/supermicro.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type supermicroBiosCfgSetting struct {
Type string `xml:"type,attr"`
}

func NewSupermicroVendorConfigManager(configFormat string) (VendorConfigManager, error) {
func NewSupermicroVendorConfigManager(configFormat string, vendorOptions map[string]string) (VendorConfigManager, error) {
supermicro := &supermicroVendorConfig{}

switch strings.ToLower(configFormat) {
Expand Down

0 comments on commit fffe54a

Please sign in to comment.