Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1205)

Unified Diff: cmd/jujuc/server/context.go

Issue 6496120: add toolsDir param to RunHook
Patch Set: add toolsDir param to RunHook Created 12 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « [revision details] ('k') | cmd/jujuc/server/context_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cmd/jujuc/server/context.go
=== modified file 'cmd/jujuc/server/context.go'
--- cmd/jujuc/server/context.go 2012-09-13 15:33:32 +0000
+++ cmd/jujuc/server/context.go 2012-09-13 20:32:50 +0000
@@ -82,11 +82,11 @@
// hookVars returns an os.Environ-style list of strings necessary to run a hook
// such that it can know what environment it's operating in, and can call back
// into ctx.
-func (ctx *HookContext) hookVars(charmDir, socketPath string) []string {
+func (ctx *HookContext) hookVars(charmDir, toolsDir, socketPath string) []string {
vars := []string{
"APT_LISTCHANGES_FRONTEND=none",
"DEBIAN_FRONTEND=noninteractive",
- "PATH=" + os.Getenv("PATH"),
+ "PATH=" + toolsDir + ":" + os.Getenv("PATH"),
"CHARM_DIR=" + charmDir,
"JUJU_CONTEXT_ID=" + ctx.Id,
"JUJU_AGENT_SOCKET=" + socketPath,
@@ -104,9 +104,9 @@
// RunHook executes a hook in an environment which allows it to to call back
// into ctx to execute jujuc tools.
-func (ctx *HookContext) RunHook(hookName, charmDir, socketPath string) error {
+func (ctx *HookContext) RunHook(hookName, charmDir, toolsDir, socketPath string) error {
ps := exec.Command(filepath.Join(charmDir, "hooks", hookName))
- ps.Env = ctx.hookVars(charmDir, socketPath)
+ ps.Env = ctx.hookVars(charmDir, toolsDir, socketPath)
ps.Dir = charmDir
outReader, err := ps.StdoutPipe()
if err != nil {
« no previous file with comments | « [revision details] ('k') | cmd/jujuc/server/context_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b