Skip to content

Commit

Permalink
Merge pull request #2380 from Daviey/master
Browse files Browse the repository at this point in the history
Don't exec uname for node attribute kernel.version
  • Loading branch information
schmichael committed Mar 1, 2017
2 parents a73d3c3 + 5d484dc commit aa84fd4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 1 addition & 12 deletions client/fingerprint/host.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit aa84fd4

Please sign in to comment.