Skip to content

Commit abd7b90

Browse files
committed
Add supermicro.Unmarshal() to config
1 parent 3db7cec commit abd7b90

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

config/asrockrack.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ func (cm *asrockrackVendorConfig) Marshal() (string, error) {
105105
}
106106
}
107107

108+
func (cm *asrockrackVendorConfig) Unmarshal(cfgData string) (biosConfig *supermicroConfig, err error) {
109+
err = xml.Unmarshal([]byte(cfgData), biosConfig)
110+
return
111+
}
112+
108113
// Generic config options
109114

110115
func (cm *asrockrackVendorConfig) EnableTPM() {

config/dell.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ func (cm *dellVendorConfig) Marshal() (string, error) {
129129
}
130130
}
131131

132+
func (cm *dellVendorConfig) Unmarshal(cfgData string) (biosConfig *dellConfig, err error) {
133+
err = xml.Unmarshal([]byte(cfgData), biosConfig)
134+
return
135+
}
136+
132137
// Generic config options
133138

134139
func (cm *dellVendorConfig) EnableTPM() {

config/interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type VendorConfigManager interface {
1212

1313
Raw(name, value string, menuPath []string)
1414
Marshal() (string, error)
15+
Unmarshal(cfgData string) (biosConfig *supermicroConfig, err error)
1516
}
1617

1718
func NewVendorConfigManager(configFormat, vendorName string, vendorOptions map[string]string) (VendorConfigManager, error) {

config/supermicro.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ func (cm *supermicroVendorConfig) Marshal() (string, error) {
114114
}
115115
}
116116

117+
func (cm *supermicroVendorConfig) Unmarshal(cfgData string) (biosConfig *supermicroConfig, err error) {
118+
err = xml.Unmarshal([]byte(cfgData), biosConfig)
119+
return
120+
}
121+
117122
// Generic config options
118123

119124
func (cm *supermicroVendorConfig) EnableTPM() {

0 commit comments

Comments
 (0)