From 57c9ff377d34849862173bbda699a5afab28dfe1 Mon Sep 17 00:00:00 2001 From: Brad Sickles Date: Wed, 1 Feb 2017 16:18:12 -0500 Subject: [PATCH] Third time is a charm. --- nomad/node_endpoint.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nomad/node_endpoint.go b/nomad/node_endpoint.go index df8042787..38edc9422 100644 --- a/nomad/node_endpoint.go +++ b/nomad/node_endpoint.go @@ -944,9 +944,8 @@ func (n *Node) DeriveVaultToken(args *structs.DeriveVaultTokenRequest, // setErr is a helper for setting the recoverable error on the reply and // logging it setErr := func(e error, recoverable bool) { - if rerr, ok := structs.NewRecoverableError(e, recoverable).(*structs.RecoverableError); ok { - reply.Error = rerr - } + if e == nil { return } + reply.Error = structs.NewRecoverableError(e, recoverable).(*structs.RecoverableError) n.srv.logger.Printf("[ERR] nomad.client: DeriveVaultToken failed (recoverable %v): %v", recoverable, e) } @@ -1135,8 +1134,8 @@ func (n *Node) DeriveVaultToken(args *structs.DeriveVaultTokenRequest, if rerr, ok := createErr.(*structs.RecoverableError); ok { reply.Error = rerr - } else if rerr, ok = structs.NewRecoverableError(createErr, false).(*structs.RecoverableError); ok { - reply.Error = rerr + } else if err != nil { + reply.Error = structs.NewRecoverableError(createErr, false).(*structs.RecoverableError) } return nil