fix(inspur): strip iBMC firmware build-timestamp suffix

A second NF5280M6 BMC-dump/live-CD pair showed RESTful version info
firmware versions carrying a build stamp ("08.05.01 (02/21/2024
16:51:27)") the live-CD does not, which churns a FIRMWARE_CHANGED event
on every source switch. cleanFirmwareVersion strips a trailing " (...)"
so BIOS/BMC match the bare live-CD version. See ADL-064 amendment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011LffAvostt3uMkiUbVUiyM
This commit is contained in:
Mikhail Chusavitin
2026-09-01 12:02:19 +03:00
co-authored by Claude Sonnet 5
parent 2fa0f78f94
commit 8278c77d98
3 changed files with 50 additions and 1 deletions
+12 -1
View File
@@ -1331,7 +1331,7 @@ func extractComponentFirmware(text string, hw *models.HardwareConfig) {
if name == "" {
continue
}
version := strings.TrimSpace(e.DevVersion)
version := cleanFirmwareVersion(e.DevVersion)
if version == "" {
continue
}
@@ -1348,6 +1348,17 @@ func extractComponentFirmware(text string, hw *models.HardwareConfig) {
}
}
// firmwareBuildStampRe matches a trailing " (build date/time)" that iBMC appends
// to RESTful version info entries, e.g. "08.05.01 (02/21/2024 16:51:27)".
var firmwareBuildStampRe = regexp.MustCompile(`\s*\([^()]*\)\s*$`)
// cleanFirmwareVersion drops the iBMC build-timestamp suffix so a BMC-dump
// firmware version matches the bare version a live-CD (dmidecode/redfish) reports
// for the same device, instead of churning a FIRMWARE_CHANGED event per import.
func cleanFirmwareVersion(v string) string {
return strings.TrimSpace(firmwareBuildStampRe.ReplaceAllString(strings.TrimSpace(v), ""))
}
// normalizeVersionInfoName converts RESTful version info dev_name to a clean label.
// Returns "" for entries that should be skipped (inactive BMC, PSU slots).
func normalizeVersionInfoName(name string) string {