mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-08 18:59:47 +00:00
perf: 添加生成 platform
This commit is contained in:
@@ -12,7 +12,7 @@ sys.path.insert(0, APPS_DIR)
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "jumpserver.settings")
|
||||
django.setup()
|
||||
|
||||
from resources.assets import AssetsGenerator, NodesGenerator
|
||||
from resources.assets import AssetsGenerator, NodesGenerator, PlatformGenerator
|
||||
from resources.users import UserGroupGenerator, UserGenerator
|
||||
from resources.perms import AssetPermissionGenerator
|
||||
from resources.terminal import CommandGenerator, SessionGenerator
|
||||
@@ -20,6 +20,7 @@ from resources.terminal import CommandGenerator, SessionGenerator
|
||||
|
||||
resource_generator_mapper = {
|
||||
'asset': AssetsGenerator,
|
||||
'platform': PlatformGenerator,
|
||||
'node': NodesGenerator,
|
||||
'user': UserGenerator,
|
||||
'user_group': UserGroupGenerator,
|
||||
|
@@ -30,9 +30,12 @@ class PlatformGenerator(FakeDataGenerator):
|
||||
def do_generate(self, batch, batch_size):
|
||||
platforms = []
|
||||
for i in batch:
|
||||
category = choice(self.categories)
|
||||
tp = choice(self.category_type[category].choices)
|
||||
data = {
|
||||
'name': forgery_py.name.company_name(),
|
||||
'category': ''
|
||||
'category': choice(self.categories),
|
||||
'type': tp
|
||||
}
|
||||
platforms.append(Platform(**data))
|
||||
Platform.objects.bulk_create(platforms, ignore_conflicts=True)
|
||||
|
Reference in New Issue
Block a user