mirror of https://github.com/jumpserver/jumpserver
perf: 网络设备 ansible enables true
parent
54d0a1b871
commit
f6c56d4979
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 4.1.10 on 2023-09-13 10:59
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def migrate_device_automation_ansible_enabled(apps, *args):
|
||||
platform_model = apps.get_model('assets', 'Platform')
|
||||
automation_model = apps.get_model('assets', 'PlatformAutomation')
|
||||
ids = platform_model.objects.filter(category='device').values_list('id', flat=True)
|
||||
automation_model.objects.filter(platform_id__in=ids).update(ansible_enabled=True)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('assets', '0122_auto_20230803_1553'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_device_automation_ansible_enabled)
|
||||
]
|
Loading…
Reference in New Issue