diff --git a/apps/assets/models/domain.py b/apps/assets/models/domain.py index 7aafab504..7fcb02c3c 100644 --- a/apps/assets/models/domain.py +++ b/apps/assets/models/domain.py @@ -144,10 +144,17 @@ class Gateway(BaseUser): key_filename=self.private_key_file, sock=sock, timeout=5) - except (paramiko.SSHException, paramiko.ssh_exception.SSHException, - paramiko.AuthenticationException, TimeoutError) as e: + except (paramiko.SSHException, + paramiko.ssh_exception.SSHException, + paramiko.ChannelException, + paramiko.AuthenticationException, + TimeoutError) as e: + + err = getattr(e, 'text', str(e)) + if err == 'Connect failed': + err = _('Connect failed') self.is_connective = False - return False, str(e) + return False, err finally: client.close() self.is_connective = True diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 73b723b66..50d851850 100644 Binary files a/apps/locale/zh/LC_MESSAGES/django.mo and b/apps/locale/zh/LC_MESSAGES/django.mo differ diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 240e3dc30..eb0be9db3 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-16 10:31+0800\n" +"POT-Creation-Date: 2021-09-16 10:57+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -687,7 +687,7 @@ msgstr "无法连接到 {ip} 上的端口 {port}" msgid "Authentication failed" msgstr "认证失败" -#: assets/models/domain.py:133 +#: assets/models/domain.py:133 assets/models/domain.py:155 msgid "Connect failed" msgstr "连接失败" @@ -1433,7 +1433,7 @@ msgstr "{ApplicationPermission} 添加 {SystemUser}" msgid "{ApplicationPermission} REMOVE {SystemUser}" msgstr "{ApplicationPermission} 移除 {SystemUser}" -#: authentication/api/connection_token.py:226 +#: authentication/api/connection_token.py:230 msgid "Invalid token" msgstr "无效的令牌"