mirror of https://github.com/jumpserver/jumpserver
feat: 支持DB2数据库
parent
e71e8cd595
commit
b42014d58e
|
@ -7,6 +7,7 @@ class DatabaseTypes(BaseType):
|
||||||
POSTGRESQL = 'postgresql', 'PostgreSQL'
|
POSTGRESQL = 'postgresql', 'PostgreSQL'
|
||||||
ORACLE = 'oracle', 'Oracle'
|
ORACLE = 'oracle', 'Oracle'
|
||||||
SQLSERVER = 'sqlserver', 'SQLServer'
|
SQLSERVER = 'sqlserver', 'SQLServer'
|
||||||
|
DB2 = 'db2', 'DB2'
|
||||||
CLICKHOUSE = 'clickhouse', 'ClickHouse'
|
CLICKHOUSE = 'clickhouse', 'ClickHouse'
|
||||||
MONGODB = 'mongodb', 'MongoDB'
|
MONGODB = 'mongodb', 'MongoDB'
|
||||||
REDIS = 'redis', 'Redis'
|
REDIS = 'redis', 'Redis'
|
||||||
|
@ -45,6 +46,15 @@ class DatabaseTypes(BaseType):
|
||||||
'change_secret_enabled': False,
|
'change_secret_enabled': False,
|
||||||
'push_account_enabled': False,
|
'push_account_enabled': False,
|
||||||
},
|
},
|
||||||
|
cls.DB2: {
|
||||||
|
'ansible_enabled': False,
|
||||||
|
'ping_enabled': False,
|
||||||
|
'gather_facts_enabled': False,
|
||||||
|
'gather_accounts_enabled': False,
|
||||||
|
'verify_account_enabled': False,
|
||||||
|
'change_secret_enabled': False,
|
||||||
|
'push_account_enabled': False,
|
||||||
|
},
|
||||||
cls.CLICKHOUSE: {
|
cls.CLICKHOUSE: {
|
||||||
'ansible_enabled': False,
|
'ansible_enabled': False,
|
||||||
'ping_enabled': False,
|
'ping_enabled': False,
|
||||||
|
@ -73,6 +83,7 @@ class DatabaseTypes(BaseType):
|
||||||
cls.POSTGRESQL: [{'name': 'PostgreSQL'}],
|
cls.POSTGRESQL: [{'name': 'PostgreSQL'}],
|
||||||
cls.ORACLE: [{'name': 'Oracle'}],
|
cls.ORACLE: [{'name': 'Oracle'}],
|
||||||
cls.SQLSERVER: [{'name': 'SQLServer'}],
|
cls.SQLSERVER: [{'name': 'SQLServer'}],
|
||||||
|
cls.DB2: [{'name': 'DB2'}],
|
||||||
cls.CLICKHOUSE: [{'name': 'ClickHouse'}],
|
cls.CLICKHOUSE: [{'name': 'ClickHouse'}],
|
||||||
cls.MONGODB: [{'name': 'MongoDB'}],
|
cls.MONGODB: [{'name': 'MongoDB'}],
|
||||||
cls.REDIS: [
|
cls.REDIS: [
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
|
||||||
oracle = 'oracle', 'Oracle'
|
oracle = 'oracle', 'Oracle'
|
||||||
postgresql = 'postgresql', 'PostgreSQL'
|
postgresql = 'postgresql', 'PostgreSQL'
|
||||||
sqlserver = 'sqlserver', 'SQLServer'
|
sqlserver = 'sqlserver', 'SQLServer'
|
||||||
|
db2 = 'db2', 'DB2'
|
||||||
clickhouse = 'clickhouse', 'ClickHouse'
|
clickhouse = 'clickhouse', 'ClickHouse'
|
||||||
redis = 'redis', 'Redis'
|
redis = 'redis', 'Redis'
|
||||||
mongodb = 'mongodb', 'MongoDB'
|
mongodb = 'mongodb', 'MongoDB'
|
||||||
|
@ -170,6 +171,12 @@ class Protocol(ChoicesMixin, models.TextChoices):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
cls.db2: {
|
||||||
|
'port': 5000,
|
||||||
|
'required': True,
|
||||||
|
'secret_types': ['password'],
|
||||||
|
'xpack': True,
|
||||||
|
},
|
||||||
cls.clickhouse: {
|
cls.clickhouse: {
|
||||||
'port': 9000,
|
'port': 9000,
|
||||||
'required': True,
|
'required': True,
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Generated by Django 4.1.10 on 2023-10-07 06:37
|
||||||
|
|
||||||
|
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.protocols.create(name='db2', port=5000, primary=True, setting={})
|
||||||
|
automation_cls.objects.create(ansible_enabled=False, platform=platform)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('assets', '0123_device_automation_ansible_enabled'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_db2_platform)
|
||||||
|
]
|
|
@ -144,7 +144,7 @@ class ConnectMethodUtil:
|
||||||
'support': [
|
'support': [
|
||||||
Protocol.mysql, Protocol.postgresql,
|
Protocol.mysql, Protocol.postgresql,
|
||||||
Protocol.oracle, Protocol.sqlserver,
|
Protocol.oracle, Protocol.sqlserver,
|
||||||
Protocol.mariadb
|
Protocol.mariadb, Protocol.db2
|
||||||
],
|
],
|
||||||
'match': 'm2m'
|
'match': 'm2m'
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue