Put login_ssh into try/except block
Fixing a NoValidConnectionsError failure encountered in DVT.
Change-Id: I6107dce43e44d6fbdd9c5a622b8466d1d61bc05a
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_robot_ssh.py b/lib/gen_robot_ssh.py
index 0174908..1928d69 100755
--- a/lib/gen_robot_ssh.py
+++ b/lib/gen_robot_ssh.py
@@ -282,10 +282,19 @@
if except_type is exceptions.AssertionError and\
re.match(r"Connection not open", str(except_value)):
- login_ssh(login_args)
- # Now we must continue to next loop iteration to retry the
- # execute_command.
- continue
+ try:
+ login_ssh(login_args)
+ # Now we must continue to next loop iteration to retry the
+ # execute_command.
+ continue
+ except Exception as login_exception:
+ except_type, except_value, except_traceback =\
+ sys.exc_info()
+ rc = 1
+ stderr = str(except_value)
+ stdout = ""
+ break
+
if (except_type is paramiko.ssh_exception.SSHException
and re.match(r"SSH session not active", str(except_value))) or\
(except_type is socket.error