Set the allocdir correctly when using the linux executor

This commit is contained in:
Alex Dadgar
2015-09-26 17:58:36 -07:00
parent 75f93ce9fb
commit 64ac893eb1

View File

@@ -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