mirror of https://github.com/jumpserver/jumpserver
fix: 修复DB2平台已经存在的问题
parent
996394ba29
commit
f6466a3a20
|
@ -6,17 +6,22 @@ from django.db import migrations
|
|||
def add_db2_platform(apps, schema_editor):
|
||||
platform_cls = apps.get_model('assets', 'Platform')
|
||||
automation_cls = apps.get_model('assets', 'PlatformAutomation')
|
||||
platform = platform_cls.objects.create(
|
||||
name='DB2', internal=True, category='database', type='db2',
|
||||
domain_enabled=True, su_enabled=False, comment='DB2',
|
||||
created_by='System', updated_by='System',
|
||||
platform, _ = platform_cls.objects.update_or_create(
|
||||
name='DB2', defaults={
|
||||
'name': 'DB2', 'category': 'database',
|
||||
'internal': True, 'type': 'db2',
|
||||
'domain_enabled': True, 'su_enabled': False,
|
||||
'su_method': None, 'comment': 'DB2', 'created_by': 'System',
|
||||
'updated_by': 'System', 'custom_fields': []
|
||||
}
|
||||
)
|
||||
platform.protocols.create(name='db2', port=5000, primary=True, setting={})
|
||||
automation_cls.objects.create(ansible_enabled=False, platform=platform)
|
||||
platform.protocols.update_or_create(name='db2', defaults={
|
||||
'name': 'db2', 'port': 50000, 'primary': True, 'setting': {}
|
||||
})
|
||||
automation_cls.objects.update_or_create(platform=platform, defaults={'ansible_enabled': False})
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0123_device_automation_ansible_enabled'),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue