From 64ac893eb12b1980aa966d893ec6bbd7b57b1369 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Sat, 26 Sep 2015 17:58:36 -0700 Subject: [PATCH] Set the allocdir correctly when using the linux executor --- client/executor/exec_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/executor/exec_linux.go b/client/executor/exec_linux.go index e762b056d..0901b4caf 100644 --- a/client/executor/exec_linux.go +++ b/client/executor/exec_linux.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/nomad/client/allocdir" + "github.com/hashicorp/nomad/client/driver/environment" "github.com/hashicorp/nomad/command" "github.com/hashicorp/nomad/helper/discover" "github.com/hashicorp/nomad/nomad/structs" @@ -127,6 +128,11 @@ func (e *LinuxExecutor) ConfigureTaskDir(taskName string, alloc *allocdir.AllocD return fmt.Errorf("Couldn't mount /proc to %v: %v", proc, err) } + // Set the tasks AllocDir environment variable. + env := environment.ParseFromList(e.Cmd.Env) + env.SetAllocDir(filepath.Join(taskDir, allocdir.SharedAllocName)) + e.Cmd.Env = env.List() + e.alloc = alloc e.mounts = true return nil