Update after review

This commit is contained in:
Kenjiro Nakayama 2016-08-09 08:57:21 +09:00
parent 5c621b74e5
commit 6a810e6f1e
2 changed files with 4 additions and 7 deletions

View File

@ -202,12 +202,11 @@ func (r *AllocRunner) saveAllocRunnerState() error {
}
func (r *AllocRunner) saveTaskRunnerState(tr *TaskRunner) error {
var err error
if err = tr.SaveState(); err != nil {
if err := tr.SaveState(); err != nil {
return fmt.Errorf("client: failed to save state for alloc %s task '%s': %v",
r.alloc.ID, tr.task.Name, err)
}
return err
return nil
}
// DestroyState is used to cleanup after ourselves

View File

@ -833,8 +833,7 @@ func (c *Client) registerNode() error {
WriteRequest: structs.WriteRequest{Region: c.Region()},
}
var resp structs.NodeUpdateResponse
err := c.RPC("Node.Register", &req, &resp)
if err != nil {
if err := c.RPC("Node.Register", &req, &resp); err != nil {
if time.Since(c.start) > registerErrGrace {
return fmt.Errorf("client: failed to register node: %v", err)
}
@ -867,8 +866,7 @@ func (c *Client) updateNodeStatus() error {
WriteRequest: structs.WriteRequest{Region: c.Region()},
}
var resp structs.NodeUpdateResponse
err := c.RPC("Node.UpdateStatus", &req, &resp)
if err != nil {
if err := c.RPC("Node.UpdateStatus", &req, &resp); err != nil {
return fmt.Errorf("client: failed to update status: %v", err)
}
if len(resp.EvalIDs) != 0 {