Try to reconnect if we receive "ssh connection not active" error during
deployment step run.
This may help in scenarios when connection is closed for some reason
before finishing running all the deployment steps.
@@ -1881,6 +1881,14 @@ class NodeDriver(BaseDriver):
except Exception as e:
tries += 1
+ if "ssh session not active" in str(e).lower():
+ # Sometimes connection gets closed or disconnected half
+ # way through.
+ # If this happens, we try to re-connect before re-attempting
+ # to run the step.
+ ssh_client = self._ssh_client_connect(ssh_client=ssh_client,
+ timeout=ssh_client.timeout)
+
if tries >= max_tries:
raise LibcloudError(value='Failed after %d tries: %s'
% (max_tries, str(e)), driver=self)
