~themue/juju-core/009-local-environ-storage

« back to all changes in this revision

Viewing changes to worker/uniter/jujuc/server.go

  • Committer: Roger Peppe
  • Date: 2013-01-17 12:19:56 UTC
  • mto: This revision was merged to the branch mainline in revision 841.
  • Revision ID: roger.peppe@canonical.com-20130117121956-uf13uyf6rmogceef
additional format check

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        getCmd CmdGetter
72
72
}
73
73
 
74
 
// badReqErr returns an error indicating a bad Request.
75
 
func badReqErr(format string, v ...interface{}) error {
 
74
// badReqErrorf returns an error indicating a bad Request.
 
75
func badReqErrorf(format string, v ...interface{}) error {
76
76
        return fmt.Errorf("bad request: "+format, v...)
77
77
}
78
78
 
80
80
// is run at a time.
81
81
func (j *Jujuc) Main(req Request, resp *Response) error {
82
82
        if req.CommandName == "" {
83
 
                return badReqErr("command not specified")
 
83
                return badReqErrorf("command not specified")
84
84
        }
85
85
        if !filepath.IsAbs(req.Dir) {
86
 
                return badReqErr("Dir is not absolute")
 
86
                return badReqErrorf("Dir is not absolute")
87
87
        }
88
88
        c, err := j.getCmd(req.ContextId, req.CommandName)
89
89
        if err != nil {
90
 
                return badReqErr("%s", err)
 
90
                return badReqErrorf("%s", err)
91
91
        }
92
92
        var stdin, stdout, stderr bytes.Buffer
93
93
        ctx := &cmd.Context{req.Dir, &stdin, &stdout, &stderr}