diff --git a/airflow/providers/ssh/hooks/ssh.py b/airflow/providers/ssh/hooks/ssh.py index eda5990288290..e0c5c96d4944d 100644 --- a/airflow/providers/ssh/hooks/ssh.py +++ b/airflow/providers/ssh/hooks/ssh.py @@ -361,7 +361,7 @@ def get_tunnel( ) else: tunnel_kwargs.update( - host_pkey_directories=[], + host_pkey_directories=None, ) client = SSHTunnelForwarder(self.remote_host, **tunnel_kwargs) diff --git a/setup.py b/setup.py index 76e4b1d2629b2..e7be3a2fe1534 100644 --- a/setup.py +++ b/setup.py @@ -465,7 +465,7 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version ssh = [ 'paramiko>=2.6.0', 'pysftp>=0.2.9', - 'sshtunnel>=0.1.4,<0.2', + 'sshtunnel>=0.3.2,<0.5', ] statsd = [ 'statsd>=3.3.0, <4.0', diff --git a/tests/providers/ssh/hooks/test_ssh.py b/tests/providers/ssh/hooks/test_ssh.py index be63093ccfbff..89068fdd695c4 100644 --- a/tests/providers/ssh/hooks/test_ssh.py +++ b/tests/providers/ssh/hooks/test_ssh.py @@ -317,7 +317,7 @@ def test_tunnel_without_password(self, ssh_mock): ssh_proxy=None, local_bind_address=('localhost',), remote_bind_address=('localhost', 1234), - host_pkey_directories=[], + host_pkey_directories=None, logger=hook.log, ) @@ -351,7 +351,7 @@ def test_tunnel_with_private_key(self, ssh_mock): ssh_proxy=None, local_bind_address=('localhost',), remote_bind_address=('localhost', 1234), - host_pkey_directories=[], + host_pkey_directories=None, logger=hook.log, ) @@ -374,7 +374,7 @@ def test_tunnel_with_private_key_passphrase(self, ssh_mock): ssh_proxy=None, local_bind_address=('localhost',), remote_bind_address=('localhost', 1234), - host_pkey_directories=[], + host_pkey_directories=None, logger=hook.log, ) @@ -397,7 +397,7 @@ def test_tunnel_with_private_key_ecdsa(self, ssh_mock): ssh_proxy=None, local_bind_address=('localhost',), remote_bind_address=('localhost', 1234), - host_pkey_directories=[], + host_pkey_directories=None, logger=hook.log, ) @@ -430,7 +430,9 @@ def test_tunnel(self): args=["python", "-c", HELLO_SERVER_CMD], stdout=subprocess.PIPE, ) - with subprocess.Popen(**subprocess_kwargs) as server_handle, hook.create_tunnel(2135, 2134): + with subprocess.Popen(**subprocess_kwargs) as server_handle, hook.get_tunnel( + local_port=2135, remote_port=2134 + ): server_output = server_handle.stdout.read(5) assert b"ready" == server_output socket = socket.socket()