U 优化主机验证规则

pull/137/head
vapao 2020-06-24 00:41:35 +08:00
parent 67c2940e5b
commit 6573dafa15
1 changed files with 2 additions and 0 deletions

View File

@ -161,5 +161,7 @@ def valid_ssh(hostname, port, username, password, with_expect=True):
raise TypeError('该主机不支持密钥认证请参考官方文档错误代码E01')
return False
except AuthenticationException:
if password and with_expect:
raise ValueError('密钥认证失败请参考官方文档错误代码E02')
return False
return True