Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Exec on non-linux platforms #4366

Merged
merged 3 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ BUG FIXES:
Consul agent [GH-4365]
* driver/docker: Fix docker credential helper support [[GH-4266](https://github.com/hashicorp/nomad/issues/4266)]
* driver/docker: Fix panic when docker client configuration options are invalid [[GH-4303](https://github.com/hashicorp/nomad/issues/4303)]
* driver/exec: Disable exec on non-linux platforms [GH-4366]
* rpc: Fix RPC tunneling when running both client/server on one machine [[GH-4317](https://github.com/hashicorp/nomad/issues/4317)]
* ui: Track the method in XHR tracking to prevent errant ACL error dialogs when stopping a job [[GH-4319](https://github.com/hashicorp/nomad/issues/4319)]
* ui: Use Polling instead of Streaming for logs in Safari [[GH-4335](https://github.com/hashicorp/nomad/issues/4335)]
Expand Down
2 changes: 1 addition & 1 deletion client/driver/exec_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import (

func (d *ExecDriver) Fingerprint(req *cstructs.FingerprintRequest, resp *cstructs.FingerprintResponse) error {
d.fingerprintSuccess = helper.BoolToPtr(false)
resp.Detected = true
resp.Detected = false
return nil
}
25 changes: 25 additions & 0 deletions client/driver/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"time"
Expand All @@ -20,6 +21,30 @@ import (
ctestutils "github.com/hashicorp/nomad/client/testutil"
)

// Test that we do not enable exec on non-linux machines
func TestExecDriver_Fingerprint_NonLinux(t *testing.T) {
if !testutil.IsTravis() {
t.Parallel()
}
if runtime.GOOS == "linux" {
t.Skip("Test only available not on Linux")
}

d := NewExecDriver(&DriverContext{})
node := &structs.Node{}

request := &cstructs.FingerprintRequest{Config: &config.Config{}, Node: node}
var response cstructs.FingerprintResponse
err := d.Fingerprint(request, &response)
if err != nil {
t.Fatalf("err: %v", err)
}

if response.Detected {
t.Fatalf("Should not be detected on non-linux platforms")
}
}

func TestExecDriver_Fingerprint(t *testing.T) {
if !testutil.IsTravis() {
t.Parallel()
Expand Down