@@ -138,7 +138,11 @@ func (r *DellRedfishBMC) getManagerForOEM() (*schemas.Manager, error) {
138138
139139func (r * DellRedfishBMC ) getCurrentBMCSettingAttribute (manager * schemas.Manager ) ([]dellAttributes , error ) {
140140 type temp struct {
141- DellOEMData dellManagerLinksOEM `json:"Dell"`
141+ Links struct {
142+ Oem struct {
143+ DellOEMData dellManagerLinksOEM `json:"Dell"`
144+ } `json:"Oem"`
145+ } `json:"Links"`
142146 }
143147
144148 tempData := & temp {}
@@ -150,7 +154,7 @@ func (r *DellRedfishBMC) getCurrentBMCSettingAttribute(manager *schemas.Manager)
150154 c := manager .GetClient ()
151155 bmcDellAttributes := []dellAttributes {}
152156 var errs []error
153- for _ , data := range tempData .DellOEMData .DellLinkAttributes {
157+ for _ , data := range tempData .Links . Oem . DellOEMData .DellLinkAttributes {
154158 bmcDellAttribute := & dellAttributes {}
155159 eTag , err := r .getObjFromURI (c , data .String (), bmcDellAttribute )
156160 if err != nil {
@@ -245,16 +249,25 @@ func (r *DellRedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID stri
245249 }
246250 }
247251 if strings .EqualFold (string (entry .Type ), string (schemas .EnumerationAttributeType )) {
252+ currentVal , hasCurrentVal := mergedBMCAttributes [name ]
253+ if ! hasCurrentVal {
254+ errs = append (errs , fmt .Errorf ("enum attribute '%v' not found in any DellAttributes endpoint" , name ))
255+ continue
256+ }
257+ // Translate the DisplayName value reported by iDRAC to the canonical
258+ // ValueName used by the registry and the PATCH payload.
259+ // currentVal may be nil (iDRAC CurrentValue=null for factory-default attributes),
260+ // in which case the loop below will find no match and we error accordingly.
248261 for _ , attrValue := range entry .Value {
249- if attrValue .ValueDisplayName == mergedBMCAttributes [ name ] {
262+ if attrValue .ValueDisplayName == currentVal {
250263 result [name ] = attrValue .ValueName
251264 break
252265 }
253266 }
254267 if _ , ok := result [name ]; ! ok {
255268 errs = append (errs ,
256- fmt .Errorf ("current setting '%v' for key '%v' not found in possible values for it (%v) " ,
257- mergedBMCAttributes [ name ] , name , entry .Value ))
269+ fmt .Errorf ("current setting '%v' for key '%v' not found in possible values: %v " ,
270+ currentVal , name , entry .Value ))
258271 }
259272 } else {
260273 result [name ] = mergedBMCAttributes [name ]
0 commit comments