Skip to content

Commit

Permalink
Fix linux serial number retrieval (#2206)
Browse files Browse the repository at this point in the history
* Change source of serial number in sysInfo function

The serial number returned by the sysInfo function in info_linux.go has been fixed. Previously, it was incorrectly fetched from the Chassis object. Now it is correctly fetched from the Product object. This aligns better with the expected system info retrieval method.

* Fallback to product.Serial in sys info

In case of the chassis is "Default String" or empty then try to use product.serial

---------

Co-authored-by: Zoltán Papp <zoltan.pmail@gmail.com>
  • Loading branch information
bcmmbaga and pappz authored Jul 2, 2024
1 parent 0f63737 commit 29e5ece
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/system/info_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@ func _getInfo() string {
func sysInfo() (serialNumber string, productName string, manufacturer string) {
var si sysinfo.SysInfo
si.GetSysInfo()
return si.Chassis.Serial, si.Product.Name, si.Product.Vendor
serial := si.Chassis.Serial
if (serial == "Default string" || serial == "") && si.Product.Serial != "" {
serial = si.Product.Serial
}
return serial, si.Product.Name, si.Product.Vendor
}

0 comments on commit 29e5ece

Please sign in to comment.