From 16529f5a517e4952921d29ddcb89b73c8dbcd2e4 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 9 Nov 2017 19:03:46 +0100 Subject: ssh_support: Fix closing of proxy ssh client The proxy ssh client was being closed even if it didn't exist. This adds a check to see if it needs to be closed. --- rumba/ssh_support.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index e1d23bf..80e079e 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -58,7 +58,6 @@ def _print_stream(stream): return o.rstrip() def ssh_connect(hostname, port, username, password, time_out, proxy_server): - logger.debug('Trying to open a connection towards node %s.' % hostname) retry = 0 max_retries = 10 while retry < max_retries: @@ -188,12 +187,11 @@ def execute_commands(testbed, ssh_config, commands, time_out=3): return o finally: ssh_config.client.close() - ssh_config.proxy_client.close() + if ssh_config.proxy_client is not None: + ssh_config.proxy_client.close() ssh_config.client = None ssh_config.proxy_client = None - - def execute_command(testbed, ssh_config, command, time_out=3): """ Remote execution of a list of shell command on hostname. By -- cgit v1.2.3