summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPeter Sprygada <privateip@users.noreply.github.com>2017-03-14 10:31:02 -0400
committerGitHub <noreply@github.com>2017-03-14 10:31:02 -0400
commiteed240797aed30a0e42a9d2cb6cdded16d75fb5c (patch)
tree2a98778a824acf0260eafae99583a9f0c814809f /bin
parent771b14acb2270ed341fc41b3d77acaa1032f7072 (diff)
downloadansible-eed240797aed30a0e42a9d2cb6cdded16d75fb5c.tar.gz
adds connection established message to ansible-connection (#22492)
This will now print a log message that displays how long the ssh connection took to establish to the remote device. If the connection established time is exceed it will also print a message to the log file that the connection attempts have exceed. Updates default connection retries to 30 fixes #22319
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-connection5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/ansible-connection b/bin/ansible-connection
index cca24df7a2..9c053e0531 100755
--- a/bin/ansible-connection
+++ b/bin/ansible-connection
@@ -126,6 +126,9 @@ class Server():
if not self.conn.connected:
raise AnsibleConnectionFailure('unable to connect to remote host')
+ connection_time = datetime.datetime.now() - self._start_time
+ display.vvvv('connection established in %s' % connection_time, play_context.remote_addr)
+
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.socket.bind(path)
self.socket.listen(1)
@@ -321,6 +324,8 @@ def main():
time.sleep(C.PERSISTENT_CONNECT_INTERVAL)
attempts += 1
if attempts > C.PERSISTENT_CONNECT_RETRIES:
+ display.vvvv('number of connection attempts exceeded, unable to connect to control socket')
+ display.vvvv('persistent_connect_interval=%s, persistent_connect_retries=%s' % (C.PERSISTENT_CONNECT_INTERVAL, C.PERSISTENT_CONNECT_RETRIES))
sys.stderr.write('failed to connect to control socket')
sys.exit(255)