From f7f9fb1bdf60fde55785b877d2cb7899a2e31876 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 15 Dec 2022 15:17:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=9D=9E=20ssh=20?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E7=9A=84=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E9=94=99=E8=AF=AF=E7=A7=81=E9=92=A5=EF=BC=8C?= =?UTF-8?q?=E5=BC=95=E5=8F=91=E7=9A=84=E8=A7=A3=E6=9E=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/models/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/assets/models/base.py b/apps/assets/models/base.py index 9c764477b..9ebb96f0e 100644 --- a/apps/assets/models/base.py +++ b/apps/assets/models/base.py @@ -63,6 +63,7 @@ class AuthMixin: @property def ssh_key_fingerprint(self): + public_key = None if self.public_key: public_key = self.public_key elif self.private_key: @@ -70,9 +71,8 @@ class AuthMixin: public_key = parse_ssh_public_key_str(self.private_key, password=self.password) except IOError as e: return str(e) - else: + if not public_key: return '' - public_key_obj = sshpubkeys.SSHKey(public_key) fingerprint = public_key_obj.hash_md5() return fingerprint