mirror of https://github.com/jumpserver/jumpserver
添加异常处理
parent
0b97c19862
commit
894911126b
|
@ -323,7 +323,7 @@ def connect(username, password, host, port, login_name, login_type='L'):
|
||||||
ssh.connect(host, port=port, username=username, password=password, key_filename=key_filename, compress=True)
|
ssh.connect(host, port=port, username=username, password=password, key_filename=key_filename, compress=True)
|
||||||
else:
|
else:
|
||||||
ssh.connect(host, port=port, username=username, password=password, compress=True)
|
ssh.connect(host, port=port, username=username, password=password, compress=True)
|
||||||
except paramiko.ssh_exception.AuthenticationException:
|
except paramiko.ssh_exception.AuthenticationException, paramiko.ssh_exception.SSHException:
|
||||||
raise ServerError('Authentication Error.')
|
raise ServerError('Authentication Error.')
|
||||||
except socket.error:
|
except socket.error:
|
||||||
raise ServerError('Connect SSH Socket Port Error, Please Correct it.')
|
raise ServerError('Connect SSH Socket Port Error, Please Correct it.')
|
||||||
|
|
Loading…
Reference in New Issue