From d1aed39daed98b79963cbd6ca503ffaaa85e25f1 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 9 Sep 2020 13:45:51 -0400 Subject: [PATCH] exit on ssh tunnel forward (#18) --- src/remote_docker_aws/core.py | 3 ++- tests/test_core.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/remote_docker_aws/core.py b/src/remote_docker_aws/core.py index 04f1148..4d61715 100644 --- a/src/remote_docker_aws/core.py +++ b/src/remote_docker_aws/core.py @@ -158,7 +158,8 @@ def start_tunnel( ip = self.get_ip() cmd_s = ( - 'sudo ssh -v -o StrictHostKeyChecking=no -o "ServerAliveInterval=60" -N -T' + "sudo ssh -v -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no" + ' -o "ServerAliveInterval=60" -N -T' f" -i {self.ssh_key_path} {INSTANCE_USERNAME}@{ip}" ) diff --git a/tests/test_core.py b/tests/test_core.py index 48f8654..cd8b6d3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -222,6 +222,8 @@ def test_tunnel(self, mock_run, mock_get_ip, remote_docker_client): "ssh", "-v", "-o", + "ExitOnForwardFailure=yes", + "-o", "StrictHostKeyChecking=no", "-o", "ServerAliveInterval=60",