From 29e5eceb6b3afab36c5df05285981a6dbc3fd466 Mon Sep 17 00:00:00 2001 From: Bethuel Mmbaga Date: Tue, 2 Jul 2024 14:19:08 +0300 Subject: [PATCH] Fix linux serial number retrieval (#2206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- client/system/info_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/system/info_linux.go b/client/system/info_linux.go index 1c5405d4d..d85a6faec 100644 --- a/client/system/info_linux.go +++ b/client/system/info_linux.go @@ -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 }