mirror of
https://github.com/clearml/clearml-session
synced 2025-06-26 18:16:55 +00:00
Enhance SSH tunnel error handling to include permission denied case
This commit is contained in:
parent
01c7e9756f
commit
951398bdb3
@ -937,7 +937,7 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem
|
||||
logfile=fd, timeout=20, encoding='utf-8')
|
||||
|
||||
# Match only "(yes/no" in order to handle both (yes/no) and (yes/no/[fingerprint])
|
||||
i = child.expect([r'(?i)password:', r'\(yes\/no', r'.*[$#] ', pexpect.EOF])
|
||||
i = child.expect([r'(?i)password:', r'\(yes\/no', r'.*[$#] ', r'Permission denied \(publickey,password\)', pexpect.EOF])
|
||||
if i == 0:
|
||||
child.sendline(ssh_password)
|
||||
try:
|
||||
@ -974,6 +974,8 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem
|
||||
raise ValueError('Incorrect password')
|
||||
except pexpect.TIMEOUT:
|
||||
pass
|
||||
elif i == 3:
|
||||
raise Exception("SSH tunneling failed: please enable password authentication in your SSH client config.")
|
||||
except Exception as ex:
|
||||
if debug:
|
||||
print("ERROR: running local SSH client [{}] failed connecting to {}: {}".format(command, args, ex))
|
||||
|
Loading…
Reference in New Issue
Block a user