From 6573dafa1548fa5917788119532db7d574c71e4c Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 24 Jun 2020 00:41:35 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/host/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spug_api/apps/host/views.py b/spug_api/apps/host/views.py index ad286c8..c8e543f 100644 --- a/spug_api/apps/host/views.py +++ b/spug_api/apps/host/views.py @@ -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