Skip to content

Commit

Permalink
Remove some dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali authored and notnoop committed Jan 8, 2019
1 parent 800a352 commit 34ee0ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 263 deletions.
220 changes: 0 additions & 220 deletions drivers/shared/executor/executor_plugin_pre_0_9_0.go

This file was deleted.

27 changes: 25 additions & 2 deletions plugins/drivers/testutils/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"path/filepath"
"runtime"
"strings"
"time"

hclog "github.com/hashicorp/go-hclog"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/plugins/base"
"github.com/hashicorp/nomad/plugins/drivers"
"github.com/hashicorp/nomad/plugins/drivers/utils"
"github.com/hashicorp/nomad/plugins/shared/hclspec"
"github.com/mitchellh/go-testing-interface"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -113,7 +113,7 @@ func (h *DriverHarness) MkAllocDir(t *drivers.TaskConfig, enableLogs bool) func(
}

taskBuilder := taskenv.NewBuilder(mock.Node(), alloc, task, "global")
utils.SetEnvvars(taskBuilder, fsi, taskDir, config.DefaultConfig())
SetEnvvars(taskBuilder, fsi, taskDir, config.DefaultConfig())

taskEnv := taskBuilder.Build()
if t.Env == nil {
Expand Down Expand Up @@ -237,3 +237,26 @@ func (d *MockDriver) SignalTask(taskID string, signal string) error {
func (d *MockDriver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error) {
return d.ExecTaskF(taskID, cmd, timeout)
}

// SetEnvvars sets path and host env vars depending on the FS isolation used.
func SetEnvvars(envBuilder *taskenv.Builder, fsi drivers.FSIsolation, taskDir *allocdir.TaskDir, conf *config.Config) {
// Set driver-specific environment variables
switch fsi {
case drivers.FSIsolationNone:
// Use host paths
envBuilder.SetAllocDir(taskDir.SharedAllocDir)
envBuilder.SetTaskLocalDir(taskDir.LocalDir)
envBuilder.SetSecretsDir(taskDir.SecretsDir)
default:
// filesystem isolation; use container paths
envBuilder.SetAllocDir(allocdir.SharedAllocContainerPath)
envBuilder.SetTaskLocalDir(allocdir.TaskLocalContainerPath)
envBuilder.SetSecretsDir(allocdir.TaskSecretsContainerPath)
}

// Set the host environment variables for non-image based drivers
if fsi != drivers.FSIsolationImage {
filter := strings.Split(conf.ReadDefault("env.blacklist", config.DefaultEnvBlacklist), ",")
envBuilder.SetHostEnvvars(filter)
}
}
41 changes: 0 additions & 41 deletions plugins/drivers/utils/utils.go

This file was deleted.

0 comments on commit 34ee0ba

Please sign in to comment.