mirror of https://github.com/openspug/spug
U 优化主机验证规则
parent
67c2940e5b
commit
6573dafa15
|
@ -161,5 +161,7 @@ def valid_ssh(hostname, port, username, password, with_expect=True):
|
||||||
raise TypeError('该主机不支持密钥认证,请参考官方文档,错误代码:E01')
|
raise TypeError('该主机不支持密钥认证,请参考官方文档,错误代码:E01')
|
||||||
return False
|
return False
|
||||||
except AuthenticationException:
|
except AuthenticationException:
|
||||||
|
if password and with_expect:
|
||||||
|
raise ValueError('密钥认证失败,请参考官方文档,错误代码:E02')
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue