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

Unified Diff: utils/ssh/run.go

Issue 62230043: state/..., worker/..., utils/...: use errgo
Patch Set: Created 11 years, 1 month 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 | « utils/ssh/generate.go ('k') | utils/ssh/run_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/ssh/run.go
=== modified file 'utils/ssh/run.go'
--- utils/ssh/run.go 2014-01-15 02:38:58 +0000
+++ utils/ssh/run.go 2014-02-12 18:03:05 +0000
@@ -5,12 +5,12 @@
import (
"bytes"
- "fmt"
"os/exec"
"strings"
"syscall"
"time"
+ "launchpad.net/errgo/errors"
utilexec "launchpad.net/juju-core/utils/exec"
)
@@ -30,7 +30,7 @@
func ExecuteCommandOnMachine(params ExecParams) (result utilexec.ExecResponse, err error) {
// execute bash accepting commands on stdin
if params.Host == "" {
- return result, fmt.Errorf("missing host address")
+ return result, errors.Newf("missing host address")
}
logger.Debugf("execute on %s", params.Host)
var options Options
@@ -45,7 +45,7 @@
command.Stdin = strings.NewReader(params.Command + "\n")
if err = command.Start(); err != nil {
- return result, err
+ return result, wrap(err)
}
commandDone := make(chan error)
go func() {
@@ -70,7 +70,7 @@
case <-time.After(params.Timeout):
logger.Infof("killing the command due to timeout")
- err = fmt.Errorf("command timed out")
+ err = errors.Newf("command timed out")
command.Kill()
}
// In either case, gather as much as we have from stdout and stderr
« no previous file with comments | « utils/ssh/generate.go ('k') | utils/ssh/run_test.go » ('j') | no next file with comments »

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