From 1e0a6b5072051ae3d361ccab1d808de925de3c9a Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 22 Mar 2023 17:17:49 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/const/device.py | 4 +--- apps/assets/const/host.py | 5 +---- apps/assets/migrations/0111_auto_20230321_1633.py | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/assets/const/device.py b/apps/assets/const/device.py index 1a9f206b2..a3bc841a8 100644 --- a/apps/assets/const/device.py +++ b/apps/assets/const/device.py @@ -16,9 +16,7 @@ class DeviceTypes(BaseType): 'charset_enabled': False, 'domain_enabled': True, 'su_enabled': True, - 'su_methods': [ - {'name': 'enable', 'id': 'enable'}, - ] + 'su_methods': ['enable'] } } diff --git a/apps/assets/const/host.py b/apps/assets/const/host.py index 2139567a9..7b6c8818c 100644 --- a/apps/assets/const/host.py +++ b/apps/assets/const/host.py @@ -19,10 +19,7 @@ class HostTypes(BaseType): 'charset': 'utf-8', # default 'domain_enabled': True, 'su_enabled': True, - 'su_methods': [ - {'name': 'sudo su -', 'id': 'sudo'}, - {'name': 'su -', 'id': 'su'} - ], + 'su_methods': ['sudo', 'su'], }, cls.WINDOWS: { 'su_enabled': False, diff --git a/apps/assets/migrations/0111_auto_20230321_1633.py b/apps/assets/migrations/0111_auto_20230321_1633.py index 0f1ba7f14..314d2ed7f 100644 --- a/apps/assets/migrations/0111_auto_20230321_1633.py +++ b/apps/assets/migrations/0111_auto_20230321_1633.py @@ -14,6 +14,8 @@ def migrate_platform_protocol_primary(apps, schema_editor): for platform in platforms: p = platform.protocols.first() + if not p: + continue p.primary = True p.save()