mirror of https://github.com/jumpserver/jumpserver
fix: creat linux asset protocol default value is sftp
parent
5a57c296a1
commit
c6befe4c4b
|
@ -2181,6 +2181,8 @@ def create_internal_platforms(apps, *args):
|
||||||
platforms_data = json.loads(platforms_data_json)
|
platforms_data = json.loads(platforms_data_json)
|
||||||
|
|
||||||
for platform_data in platforms_data:
|
for platform_data in platforms_data:
|
||||||
|
protocols = platform_data.pop('protocols', [])
|
||||||
|
platform_data['protocols'] = [p for p in protocols if p.pop('primary', True) is not None]
|
||||||
AllTypes.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls,
|
AllTypes.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls,
|
||||||
automation_cls=automation_cls)
|
automation_cls=automation_cls)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 4.1.13 on 2024-07-09 10:19
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_platform_protocol_primary(apps, schema_editor):
|
||||||
|
platform_model = apps.get_model('assets', 'Platform')
|
||||||
|
platforms = platform_model.objects.all()
|
||||||
|
|
||||||
|
for platform in platforms:
|
||||||
|
p = platform.protocols.filter(primary=True).first()
|
||||||
|
if p:
|
||||||
|
continue
|
||||||
|
p = platform.protocols.first()
|
||||||
|
if not p:
|
||||||
|
continue
|
||||||
|
p.primary = True
|
||||||
|
p.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
('assets', '0003_auto_20180109_2331'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(migrate_platform_protocol_primary)
|
||||||
|
]
|
Loading…
Reference in New Issue