Merge pull request #2380 from Daviey/master

Don't exec uname for node attribute kernel.version
This commit is contained in:
Michael Schurter 2017-03-01 11:42:54 -08:00 committed by GitHub
commit d72eb279ea
2 changed files with 2 additions and 12 deletions

View file

@ -19,6 +19,7 @@ IMPROVEMENTS:
* client: Don't force uppercase meta keys in env vars [GH-2338]
* client: Reproducible Node ID on OSes that provide system-level UUID
[GH-2277]
* client: Don't exec `uname -r` for node attribute kernel.version [GH-2380]
* driver/docker: Add support for volume drivers [GH-2351]
* driver/docker: Docker image coordinator and caching [GH-2361]
* jobspec: Add leader task to allow graceful shutdown of other tasks within

View file

@ -1,11 +1,8 @@
package fingerprint
import (
"fmt"
"log"
"os/exec"
"runtime"
"strings"
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/nomad/structs"
@ -35,15 +32,7 @@ func (f *HostFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (b
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"] = strings.Trim(string(out), "\n")
}
node.Attributes["kernel.version"] = hostInfo.KernelVersion
node.Attributes["unique.hostname"] = hostInfo.Hostname