From a83d1c7c46fc9a384543e486f9bc5ad7839b63c3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 17:32:28 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20applet=20host=20pl?= =?UTF-8?q?atform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0116_auto_20230418_1726.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 apps/assets/migrations/0116_auto_20230418_1726.py diff --git a/apps/assets/migrations/0116_auto_20230418_1726.py b/apps/assets/migrations/0116_auto_20230418_1726.py new file mode 100644 index 000000000..e15a5cdc0 --- /dev/null +++ b/apps/assets/migrations/0116_auto_20230418_1726.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.17 on 2023-04-18 09:26 + +from django.db import migrations + + +def update_remote_app_platform(apps, schema_editor): + platform_cls = apps.get_model('assets', 'Platform') + remote_app_host = platform_cls.objects.filter(name='RemoteAppHost').first() + if not remote_app_host: + return + + protocols = remote_app_host.protocols.all() + for protocol in protocols: + if protocol.name == 'rdp': + protocol.primary = True + protocol.save() + elif protocol.name == 'ssh': + protocol.required = True + protocol.save() + + +class Migration(migrations.Migration): + dependencies = [ + ('assets', '0115_auto_20230417_1425'), + ] + + operations = [ + migrations.RunPython(update_remote_app_platform) + ]