wwclient: added dmidecode as a method to obtain asset-tag if smbios fails fix #1110"
Signed-off-by: Josh Burks <jeburks2@asu.edu>
This commit is contained in:
@@ -126,6 +126,15 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
|||||||
localUUID, _ = sysinfoDump.UUID()
|
localUUID, _ = sysinfoDump.UUID()
|
||||||
x := smbiosDump.SystemEnclosure()
|
x := smbiosDump.SystemEnclosure()
|
||||||
tag = strings.ReplaceAll(x.AssetTagNumber(), " ", "_")
|
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 {
|
} else {
|
||||||
// Raspberry Pi serial and DUID locations
|
// Raspberry Pi serial and DUID locations
|
||||||
// /sys/firmware/devicetree/base/serial-number
|
// /sys/firmware/devicetree/base/serial-number
|
||||||
|
|||||||
Reference in New Issue
Block a user