From 5e7d474bb73538924f0e30100a02bb0e395fbce2 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 25 May 2023 13:57:02 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20RemoteAppHost=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20winrm=20(#10542)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ibuler --- .../migrations/0118_auto_20230524_1647.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 apps/assets/migrations/0118_auto_20230524_1647.py diff --git a/apps/assets/migrations/0118_auto_20230524_1647.py b/apps/assets/migrations/0118_auto_20230524_1647.py new file mode 100644 index 000000000..cfe8c9f99 --- /dev/null +++ b/apps/assets/migrations/0118_auto_20230524_1647.py @@ -0,0 +1,33 @@ +# Generated by Django 3.2.17 on 2023-05-24 08:45 + +from django.db import migrations + + +def migrate_remote_applet_host_support_winrm(apps, *args): + platform_cls = apps.get_model('assets', 'Platform') + protocol_cls = apps.get_model('assets', 'PlatformProtocol') + applet_host_platform = platform_cls.objects.filter(name='RemoteAppHost').first() + if not applet_host_platform: + return + + protocols = applet_host_platform.protocols.all() + if not protocols.filter(name='winrm').exists(): + protocol = protocol_cls(name='winrm', port=5985, public=False, platform=applet_host_platform) + protocol.save() + applet_host_platform.protocols.add(protocol) + + ssh_protocol = protocols.filter(name='ssh').first() + if ssh_protocol: + ssh_protocol.required = False + ssh_protocol.default = True + ssh_protocol.save() + + +class Migration(migrations.Migration): + dependencies = [ + ('assets', '0117_alter_baseautomation_params'), + ] + + operations = [ + migrations.RunPython(migrate_remote_applet_host_support_winrm) + ]