From d2b026a692a44ff8543122ad3b2d264954132653 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Wed, 4 Apr 2018 16:06:06 -0700 Subject: [PATCH] agent: return error when failing to apply network key Signed-off-by: Stephen J Day --- agent/agent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 5a67327bd9..2d66408048 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -2,7 +2,6 @@ package agent import ( "bytes" - "fmt" "math/rand" "reflect" "sync" @@ -11,6 +10,7 @@ import ( "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/log" + "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -444,7 +444,7 @@ func (a *Agent) handleSessionMessage(ctx context.Context, message *api.SessionMe if !same { a.keys = message.NetworkBootstrapKeys if err := a.config.Executor.SetNetworkBootstrapKeys(a.keys); err != nil { - panic(fmt.Errorf("configuring network key failed")) + return errors.Wrap(err, "configuring network key failed") } } }