diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-09 19:03:46 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-09 19:03:46 +0100 |
commit | 16529f5a517e4952921d29ddcb89b73c8dbcd2e4 (patch) | |
tree | 2672f65e3c677c4b7d5365c18fa2469acb6ce3ae | |
parent | 446cb363d9dd47fc759cff25c6c19fbe2bdc2bf0 (diff) | |
download | rumba-16529f5a517e4952921d29ddcb89b73c8dbcd2e4.tar.gz rumba-16529f5a517e4952921d29ddcb89b73c8dbcd2e4.zip |
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.
-rw-r--r-- | rumba/ssh_support.py | 6 |
1 files 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 |