diff --git a/config/asrockrack.go b/config/asrockrack.go index a4319c1..bced5d8 100644 --- a/config/asrockrack.go +++ b/config/asrockrack.go @@ -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) { diff --git a/config/dell.go b/config/dell.go index 96f2886..a607bf0 100644 --- a/config/dell.go +++ b/config/dell.go @@ -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) { @@ -53,13 +53,15 @@ func NewDellVendorConfigManager(configFormat string) (VendorConfigManager, error SystemConfiguration: &dellSystemConfiguration{}, } + dell.setSystemConfiguration(vendorOptions["model"], vendorOptions["servicetag"]) return dell, nil } -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 diff --git a/config/interface.go b/config/interface.go index 3bcc4c1..9684cce 100644 --- a/config/interface.go +++ b/config/interface.go @@ -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)) } diff --git a/config/supermicro.go b/config/supermicro.go index 8ed7d3e..25fd02e 100644 --- a/config/supermicro.go +++ b/config/supermicro.go @@ -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) {