From 8e81aee1fd411bee18dfb9d02fb8462857ae569a Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 13 Apr 2023 18:22:46 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20luna=E8=BF=9E=E6=8E=A5=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=20WinRM=20=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/models/platform.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/assets/models/platform.py b/apps/assets/models/platform.py index 08cd7e009..2eb786498 100644 --- a/apps/assets/models/platform.py +++ b/apps/assets/models/platform.py @@ -26,6 +26,14 @@ class PlatformProtocol(models.Model): def secret_types(self): return Protocol.settings().get(self.name, {}).get('secret_types', ['password']) + def set_public(self): + private_protocol_set = ('winrm',) + self.public = self.name not in private_protocol_set + + def save(self, **kwargs): + self.set_public() + return super().save(**kwargs) + class PlatformAutomation(models.Model): ansible_enabled = models.BooleanField(default=False, verbose_name=_("Enabled"))