Skip to content

Commit

Permalink
Merge pull request #757 from hashicorp/f-tmp
Browse files Browse the repository at this point in the history
Add tmp folder to each task directory
  • Loading branch information
dadgar committed Feb 5, 2016
2 parents 0ad448f + ec583e4 commit f2b9e18
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client/allocdir/alloc_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var (
// The name of the directory that exists inside each task directory
// regardless of driver.
TaskLocal = "local"

// TaskDirs is the set of directories created in each tasks directory.
TaskDirs = []string{"tmp"}
)

type AllocDir struct {
Expand Down Expand Up @@ -120,6 +123,18 @@ func (d *AllocDir) Build(tasks []*structs.Task) error {
}

d.TaskDirs[t.Name] = taskDir

// Create the directories that should be in every task.
for _, dir := range TaskDirs {
local := filepath.Join(taskDir, dir)
if err := os.Mkdir(local, 0777); err != nil {
return err
}

if err := d.dropDirPermissions(local); err != nil {
return err
}
}
}

return nil
Expand Down

0 comments on commit f2b9e18

Please sign in to comment.