From 1afbe296422310852b3fccb50423810b622fb768 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sat, 26 Aug 2017 01:16:40 +0200 Subject: [PATCH] Remove transport_test for some connection types (#28450) So we are removing the transport_test for the listed connection types, because they fail to take into account bastion or proxy servers for testing the transport. The result of removing this, is that modules using this facility will do a complete round-trip attempt, running a module, which is a bit heavier but correct. This fixes #23774 --- lib/ansible/plugins/connection/paramiko_ssh.py | 8 -------- lib/ansible/plugins/connection/ssh.py | 7 ------- lib/ansible/plugins/connection/winrm.py | 8 -------- 3 files changed, 23 deletions(-) diff --git a/lib/ansible/plugins/connection/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py index 4763922806..17cb287c24 100644 --- a/lib/ansible/plugins/connection/paramiko_ssh.py +++ b/lib/ansible/plugins/connection/paramiko_ssh.py @@ -130,14 +130,6 @@ class Connection(ConnectionBase): transport = 'paramiko' - def transport_test(self, connect_timeout): - ''' Test the transport mechanism, if available ''' - host = self._play_context.remote_addr - port = int(self._play_context.port or 22) - display.vvv("attempting transport test to %s:%s" % (host, port)) - sock = socket.create_connection((host, port), connect_timeout) - sock.close() - def _cache_key(self): return "%s__%s__" % (self._play_context.remote_addr, self._play_context.remote_user) diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index 94e820b073..bbdef533da 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -260,13 +260,6 @@ class Connection(ConnectionBase): def _connect(self): return self - def transport_test(self, connect_timeout): - ''' Test the transport mechanism, if available ''' - port = int(self.port or 22) - display.vvv("attempting transport test to %s:%s" % (self.host, port)) - sock = socket.create_connection((self.host, port), connect_timeout) - sock.close() - @staticmethod def _create_control_path(host, port, user, connection=None): '''Make a hash for the controlpath based on con attributes''' diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 0c4f9482ec..23248ee7f2 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -90,14 +90,6 @@ class Connection(ConnectionBase): super(Connection, self).__init__(*args, **kwargs) - def transport_test(self, connect_timeout): - ''' Test the transport mechanism, if available ''' - host = self._winrm_host - port = int(self._winrm_port) - display.vvv("attempting transport test to %s:%s" % (host, port)) - sock = socket.create_connection((host, port), connect_timeout) - sock.close() - def set_host_overrides(self, host, hostvars=None): ''' Override WinRM-specific options from host variables.