From 129909237c2aa65d478107ec7454f81380a54076 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 28 Nov 2017 16:38:07 +0200 Subject: [PATCH] Switch the log of SSH retries to display only if the 1st connection failed and we retry. It's just annoying to see it on every SSH connection. --- lago/ssh.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lago/ssh.py b/lago/ssh.py index cdb4ee14..f961153a 100644 --- a/lago/ssh.py +++ b/lago/ssh.py @@ -331,11 +331,6 @@ def get_ssh_client( client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy(), ) while ssh_tries > 0: - LOGGER.debug( - 'Still got %d tries for %s', - ssh_tries, - host_name, - ) try: client.connect( ip_addr, @@ -360,6 +355,11 @@ def get_ssh_client( except EOFError as err: LOGGER.debug('EOFError connecting to %s: %s', host_name, err) ssh_tries -= 1 + LOGGER.debug( + 'Still got %d tries for %s', + ssh_tries, + host_name, + ) time.sleep(1) else: end_time = time.time()