Conversation
📝 WalkthroughWalkthroughThe Dell iDRAC RawData parsing for current BMC setting attributes corrects the JSON structure path from top-level Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
bmc/redfish_dell.go (1)
252-255: Consider symmetric missing-value validation for non-enum attributes.Enum attributes now fail fast when absent, but non-enum attributes still read from
mergedBMCAttributes[name]directly and may returnnilwithout an error. Aligning both branches will avoid partial/nil results slipping through.Suggested parity fix
if strings.EqualFold(string(entry.Type), string(schemas.EnumerationAttributeType)) { currentVal, hasCurrentVal := mergedBMCAttributes[name] if !hasCurrentVal { errs = append(errs, fmt.Errorf("enum attribute '%v' not found in any DellAttributes endpoint", name)) continue } // Translate the DisplayName value reported by iDRAC to the canonical // ValueName used by the registry and the PATCH payload. // currentVal may be nil (iDRAC CurrentValue=null for factory-default attributes), // in which case the loop below will find no match and we error accordingly. for _, attrValue := range entry.Value { if attrValue.ValueDisplayName == currentVal { result[name] = attrValue.ValueName break } } if _, ok := result[name]; !ok { errs = append(errs, fmt.Errorf("current setting '%v' for key '%v' not found in possible values: %v", currentVal, name, entry.Value)) } } else { - result[name] = mergedBMCAttributes[name] + currentVal, hasCurrentVal := mergedBMCAttributes[name] + if !hasCurrentVal { + errs = append(errs, fmt.Errorf("attribute '%v' not found in any DellAttributes endpoint", name)) + continue + } + result[name] = currentVal }Also applies to: 272-274
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bmc/redfish_dell.go` around lines 252 - 255, The enum branch currently checks mergedBMCAttributes[name] and appends an error if missing but the non-enum branch reads mergedBMCAttributes[name] directly and can yield nil; update the non-enum handling to mirror the enum path by first doing currentVal, hasCurrentVal := mergedBMCAttributes[name] and if !hasCurrentVal append an error to errs (using the same error message pattern) and continue before using currentVal (affecting the code that reads mergedBMCAttributes[name] later in the function); ensure you reference mergedBMCAttributes, name and errs when making this parity change so both branches consistently validate missing keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@bmc/redfish_dell.go`:
- Around line 252-255: The enum branch currently checks
mergedBMCAttributes[name] and appends an error if missing but the non-enum
branch reads mergedBMCAttributes[name] directly and can yield nil; update the
non-enum handling to mirror the enum path by first doing currentVal,
hasCurrentVal := mergedBMCAttributes[name] and if !hasCurrentVal append an error
to errs (using the same error message pattern) and continue before using
currentVal (affecting the code that reads mergedBMCAttributes[name] later in the
function); ensure you reference mergedBMCAttributes, name and errs when making
this parity change so both branches consistently validate missing keys.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1bf8fa9e-dfaa-42e0-88c6-7596087ed6a7
📒 Files selected for processing (1)
bmc/redfish_dell.go
atd9876
left a comment
There was a problem hiding this comment.
This is the same issue I encountered, and the same fix.
LGTM
Fixes #843
Summary by CodeRabbit