From 790375822ca5b52442372f5c38b6ded81cf21995 Mon Sep 17 00:00:00 2001 From: Josh Burks Date: Tue, 18 Jun 2024 09:07:56 -0700 Subject: [PATCH] wwclient: added dmidecode as a method to obtain asset-tag if smbios fails fix #1110" Signed-off-by: Josh Burks --- internal/app/wwclient/root.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/app/wwclient/root.go b/internal/app/wwclient/root.go index 7cd728bc..3f9c08b3 100644 --- a/internal/app/wwclient/root.go +++ b/internal/app/wwclient/root.go @@ -126,6 +126,15 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) { localUUID, _ = sysinfoDump.UUID() x := smbiosDump.SystemEnclosure() tag = strings.ReplaceAll(x.AssetTagNumber(), " ", "_") + if tag == "Unknown" { + dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output() + if err == nil { + chassisAssetTag := strings.TrimSpace(string(dmiOut)) + if chassisAssetTag != "" { + tag = chassisAssetTag + } + } + } } else { // Raspberry Pi serial and DUID locations // /sys/firmware/devicetree/base/serial-number