From a5485011c8f1837009f7c55545e3a779c1686d25 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Tue, 3 Dec 2019 11:24:12 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E5=A4=8D=E7=BD=91=E5=85=B3?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8A=A5500=E9=94=99=E8=AF=AF=EF=BC=9B?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=BF=9E=E6=8E=A5=E6=8A=A5500=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/domain.py | 2 +- apps/assets/models/domain.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/assets/api/domain.py b/apps/assets/api/domain.py index e6f6c0550..e032c41bb 100644 --- a/apps/assets/api/domain.py +++ b/apps/assets/api/domain.py @@ -27,7 +27,7 @@ class DomainViewSet(OrgBulkModelViewSet): class GatewayViewSet(OrgBulkModelViewSet): model = Gateway - filter_fields = ("domain__name", "name", "username", "ip", "domain") + filter_fields = ("domain__name", "name", "username", "ip", "domain__id") search_fields = filter_fields permission_classes = (IsOrgAdmin,) serializer_class = serializers.GatewaySerializer diff --git a/apps/assets/models/domain.py b/apps/assets/models/domain.py index 99e677a07..af3fe612f 100644 --- a/apps/assets/models/domain.py +++ b/apps/assets/models/domain.py @@ -63,8 +63,9 @@ class Gateway(AssetUser): def test_connective(self, local_port=None): if local_port is None: local_port = self.port - if not re.match(r'\w+$', self.password): - return False, _("Password should not contain special characters") + if self.password is not None: + if not re.match(r'\w+$', self.password): + return False, _("Password should not contain special characters") client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy())