Fix ssh proxy regression
The recent change [1] broke ssh proxy because ssh.close()
closes the transport connection as well. Fix it by creating
proxy connections on every retries.
[1] Ida499a80be184b1af9b53d4ab27a8abbc4d59898
Closes-Bug: #1694458
Change-Id: Ic9a65d1da518a7253a1f6e4f4a909138f9e52de9
diff --git a/tempest/lib/common/ssh.py b/tempest/lib/common/ssh.py
index 657c0c1..d4ec6ad 100644
--- a/tempest/lib/common/ssh.py
+++ b/tempest/lib/common/ssh.py
@@ -84,10 +84,6 @@
ssh.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
_start_time = time.time()
- if self.proxy_client is not None:
- proxy_chan = self._get_proxy_channel()
- else:
- proxy_chan = None
if self.pkey is not None:
LOG.info("Creating ssh connection to '%s:%d' as '%s'"
" with public key authentication",
@@ -98,6 +94,10 @@
self.host, self.port, self.username, str(self.password))
attempts = 0
while True:
+ if self.proxy_client is not None:
+ proxy_chan = self._get_proxy_channel()
+ else:
+ proxy_chan = None
try:
ssh.connect(self.host, port=self.port, username=self.username,
password=self.password,