From 5747f4e8904935248a852957cc192b866f82efbc Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Fri, 14 Oct 2016 11:23:35 -0700 Subject: [PATCH] prevent panic when ssh reconnect fails --- communicator/ssh/communicator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index bc4d0f40b..289543495 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -240,7 +240,11 @@ func (c *comm) newSession() (session *ssh.Session, err error) { return nil, err } - return c.client.NewSession() + if c.client == nil { + err = errors.New("client not available") + } else { + session, err = c.client.NewSession() + } } return session, nil