mirror of
https://github.com/clearml/clearml-session
synced 2025-05-06 13:04:44 +00:00
bugfix: handle ssh key login
This commit is contained in:
parent
e5db4890d9
commit
4a946d69a5
@ -669,7 +669,7 @@ def wait_for_machine(state, task):
|
|||||||
def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_remote_pair_list, debug=False):
|
def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_remote_pair_list, debug=False):
|
||||||
print('Starting SSH tunnel')
|
print('Starting SSH tunnel')
|
||||||
child = None
|
child = None
|
||||||
args = ['-N', '-C',
|
args = ['-C',
|
||||||
'{}@{}'.format(username, remote_address), '-p', '{}'.format(ssh_port),
|
'{}@{}'.format(username, remote_address), '-p', '{}'.format(ssh_port),
|
||||||
'-o', 'UserKnownHostsFile=/dev/null',
|
'-o', 'UserKnownHostsFile=/dev/null',
|
||||||
'-o', 'Compression=yes',
|
'-o', 'Compression=yes',
|
||||||
@ -690,7 +690,7 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem
|
|||||||
args=args,
|
args=args,
|
||||||
logfile=fd, timeout=20, encoding='utf-8')
|
logfile=fd, timeout=20, encoding='utf-8')
|
||||||
|
|
||||||
i = child.expect([r'(?i)password:', r'\(yes\/no\)', r'.*[$#] ', pexpect.EOF])
|
i = child.expect([r'(?i)password:', r'\(yes\/no', r'.*[$#] ', pexpect.EOF])
|
||||||
if i == 0:
|
if i == 0:
|
||||||
child.sendline(ssh_password)
|
child.sendline(ssh_password)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user