Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
bin: expose TSURU_USER env var to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarsa committed Feb 19, 2015
1 parent 80aec6c commit a272881
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/gandalf.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func executeAction(f func(*user.User, *repository.Repository) bool, errMsg strin
cmd := exec.Command(c[0], c[1:]...)
cmd.Stdin = os.Stdin
cmd.Stdout = stdout
baseEnv := os.Environ()
baseEnv = append(baseEnv, "TSURU_USER="+u.Name)
cmd.Env = baseEnv
stderr := &bytes.Buffer{}
cmd.Stderr = stderr
err = cmd.Run()
Expand Down
1 change: 1 addition & 0 deletions bin/gandalf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func (s *S) TestExecuteActionShouldExecuteGitReceivePackWhenUserHasWritePermissi
c.Assert(err, check.IsNil)
expected := path.Join(p, "myapp.git")
c.Assert(stdout.String(), check.Equals, expected)
c.Assert(commandmocker.Envs(dir), check.Matches, `(?s).*TSURU_USER=testuser.*`)
}

func (s *S) TestExecuteActionShouldNotCallSSH_ORIGINAL_COMMANDWhenUserDoesNotExist(c *check.C) {
Expand Down

0 comments on commit a272881

Please sign in to comment.