Merge lp:~axwalk/juju-core/lp1293310-non-existent-hooks into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2425 |
Proposed branch: | lp:~axwalk/juju-core/lp1293310-non-existent-hooks |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
34 lines (+10/-8) 1 file modified
worker/uniter/context.go (+10/-8) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1293310-non-existent-hooks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+211247@code.launchpad.net |
Commit message
worker/uniter: explicit LookPath for hooks
Go 1.3/tip changes os/exec.Command such that it
conditionally calls LookPath, based on whether or
not the specified path in is absolute. Since this
differs across versions, I have simply changed our
code to explicitly call LookPath all the time.
No tests changed; an existing test failed with Go
tip, and I verified the change fixes it.
Fixes lp:1293310
Description of the change
worker/uniter: explicit LookPath for hooks
Go 1.3/tip changes os/exec.Command such that it
conditionally calls LookPath, based on whether or
not the specified path in is absolute. Since this
differs across versions, I have simply changed our
code to explicitly call LookPath all the time.
No tests changed; an existing test failed with Go
tip, and I verified the change fixes it.
Fixes lp:1293310
Reviewers: mp+211247_ code.launchpad. net,
Message:
Please take a look.
Description:
worker/uniter: explicit LookPath for hooks
Go 1.3/tip changes os/exec.Command such that it
conditionally calls LookPath, based on whether or
not the specified path in is absolute. Since this
differs across versions, I have simply changed our
code to explicitly call LookPath all the time.
No tests changed; an existing test failed with Go
tip, and I verified the change fixes it.
Fixes lp:1293310
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1293310- non-existent- hooks/+ merge/211247
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/76780043/
Affected files (+12, -8 lines): uniter/ context. go
A [revision details]
M worker/
Index: [revision details] 20140316111812- jtsxq0bnl0ko174 7
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: worker/ uniter/ context. go uniter/ context. go' uniter/ context. go 2014-03-05 19:41:34 +0000 uniter/ context. go 2014-03-17 05:49:29 +0000
=== modified file 'worker/
--- worker/
+++ worker/
@@ -253,7 +253,16 @@
}
func (ctx *HookContext) runCharmHook( hookName, charmDir string, env filepath. Join(charmDir, "hooks", hookName)) filepath. Join(charmDir, "hooks", hookName)) ee.Err) { Infof(" skipped %q hook (not implemented)", hookName) or{hookName} stop() ee.Err) { Infof(" skipped %q hook (not implemented)", hookName) or{hookName}
[]string) error {
- ps := exec.Command(
+ hook, err := exec.LookPath(
+ if err != nil {
+ if ee, ok := err.(*exec.Error); ok && os.IsNotExist(
+ // Missing hook is perfectly valid, but worth mentioning.
+ logger.
+ return &missingHookErr
+ }
+ return err
+ }
+ ps := exec.Command(hook)
ps.Env = env
ps.Dir = charmDir
outReader, outWriter, err := os.Pipe()
@@ -274,13 +283,6 @@
err = ps.Wait()
}
hookLogger.
- if ee, ok := err.(*exec.Error); ok && err != nil {
- if os.IsNotExist(
- // Missing hook is perfectly valid, but worth mentioning.
- logger.
- return &missingHookErr
- }
- }
return err
}