mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Change 'os' to 'kernel.name'; add 'kernel.version' for *nix*
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package fingerprint
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
||||
"github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
@@ -28,8 +31,19 @@ func (f *HostFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (b
|
||||
|
||||
node.Attributes["os.name"] = hostInfo.Platform
|
||||
node.Attributes["os.version"] = hostInfo.PlatformVersion
|
||||
|
||||
node.Attributes["kernel.name"] = runtime.GOOS
|
||||
node.Attributes["kernel.version"] = ""
|
||||
|
||||
if runtime.GOOS != "windows" {
|
||||
out, err := exec.Command("uname", "-r").Output()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Failed to run uname: %s", err)
|
||||
}
|
||||
node.Attributes["kernel.version"] = string(out)
|
||||
}
|
||||
|
||||
node.Attributes["hostname"] = hostInfo.Hostname
|
||||
node.Attributes["kernel.name"] = hostInfo.OS
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user