From b3b7575b0c9a975efa7e999c01af574378b84fda Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:07:34 +0800 Subject: [PATCH 01/48] =?UTF-8?q?fix:=20=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B5=84=E4=BA=A7=E8=B4=A6=E5=8F=B7=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20secret=20(#10221)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index de9931a62..1827ed439 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -264,7 +264,7 @@ class AssetAccountBulkSerializer(AccountCreateUpdateSerializerMixin, serializers @staticmethod def _handle_update_create(vd, lookup): ori = Account.objects.filter(**lookup).first() - if ori and ori.secret == vd['secret']: + if ori and ori.secret == vd.get('secret'): return ori, False, 'skipped' instance, value = Account.objects.update_or_create(defaults=vd, **lookup) From 2b00e6e3a1221558f18578e2e1d4c2f1203ec089 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:10:34 +0800 Subject: [PATCH 02/48] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E5=88=97=E8=A1=A8=20mini=20=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20(#10220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ibuler --- apps/assets/serializers/asset/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 2a50d3419..5bc0fbc2c 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -176,8 +176,12 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali return category = request.path.strip('/').split('/')[-1].rstrip('s') field_category = self.fields.get('category') + if not field_category: + return field_category.choices = Category.filter_choices(category) field_type = self.fields.get('type') + if not field_type: + return field_type.choices = AllTypes.filter_choices(category) @classmethod From 20e7efcd70c8f88e134fdc3991e2db3a78443c64 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 17 Apr 2023 15:24:10 +0800 Subject: [PATCH 03/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20platform=20a?= =?UTF-8?q?utomation=20=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0115_auto_20230417_1425.py | 53 +++++++++++++++++++ apps/assets/models/platform.py | 6 +-- 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 apps/assets/migrations/0115_auto_20230417_1425.py diff --git a/apps/assets/migrations/0115_auto_20230417_1425.py b/apps/assets/migrations/0115_auto_20230417_1425.py new file mode 100644 index 000000000..544891a03 --- /dev/null +++ b/apps/assets/migrations/0115_auto_20230417_1425.py @@ -0,0 +1,53 @@ +# Generated by Django 3.2.17 on 2023-04-17 06:32 + +from django.db import migrations, models + + +def migrate_platform_automation_id(apps, schema_editor): + platform_model = apps.get_model('assets', 'Platform') + for platform in platform_model.objects.all(): + platform._automation_id = platform.automation.id + platform.save(update_fields=['_automation_id']) + + +def migrate_automation_platform(apps, schema_editor): + platform_model = apps.get_model('assets', 'Platform') + automation_model = apps.get_model('assets', 'PlatformAutomation') + platforms = platform_model.objects.all() + for platform in platforms: + if not platform._automation_id: + continue + automation = automation_model.objects.filter(id=platform._automation_id).first() + if not automation: + continue + automation.platform = platform + automation.save(update_fields=['platform']) + + +def migrate_null_platform_automation(apps, schema_editor): + automation_model = apps.get_model('assets', 'PlatformAutomation') + null_platform_automations = automation_model.objects.filter(platform__isnull=True) + null_platform_automations.delete() + + +class Migration(migrations.Migration): + dependencies = [ + ('assets', '0114_baseautomation_params'), + ] + + operations = [ + migrations.AddField( + model_name='platform', + name='_automation_id', + field=models.UUIDField(editable=False, null=True), + ), + migrations.RunPython(migrate_platform_automation_id), + migrations.RemoveField(model_name='platform', name='automation'), + migrations.AddField( + model_name='platformautomation', + name='platform', + field=models.OneToOneField(null=True, on_delete=models.deletion.CASCADE, + related_name='automation', to='assets.platform'), + ), + migrations.RunPython(migrate_automation_platform), + ] diff --git a/apps/assets/models/platform.py b/apps/assets/models/platform.py index 4927ce793..411b9ded4 100644 --- a/apps/assets/models/platform.py +++ b/apps/assets/models/platform.py @@ -72,6 +72,7 @@ class PlatformAutomation(models.Model): max_length=32, blank=True, null=True, verbose_name=_("Gather facts method") ) gather_accounts_params = models.JSONField(default=dict, verbose_name=_("Gather facts params")) + platform = models.OneToOneField('Platform', on_delete=models.CASCADE, related_name='automation', null=True) class Platform(JMSBaseModel): @@ -99,11 +100,8 @@ class Platform(JMSBaseModel): # 账号有关的 su_enabled = models.BooleanField(default=False, verbose_name=_("Su enabled")) su_method = models.CharField(max_length=32, blank=True, null=True, verbose_name=_("Su method")) - automation = models.OneToOneField( - PlatformAutomation, on_delete=models.CASCADE, related_name='platform', - blank=True, null=True, verbose_name=_("Automation") - ) custom_fields = models.JSONField(null=True, default=list, verbose_name=_("Custom fields")) + _automation_id = models.UUIDField(null=True, editable=False) @property def type_constraints(self): From 024d344f7edd51c6f6c83a10b3b4b7928dfaacf1 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 17 Apr 2023 15:40:05 +0800 Subject: [PATCH 04/48] =?UTF-8?q?perf:=20=E5=8E=BB=E6=8E=89=20=5Fautmoatio?= =?UTF-8?q?n=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/migrations/0115_auto_20230417_1425.py | 7 +------ apps/assets/models/platform.py | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/assets/migrations/0115_auto_20230417_1425.py b/apps/assets/migrations/0115_auto_20230417_1425.py index 544891a03..4995ac85e 100644 --- a/apps/assets/migrations/0115_auto_20230417_1425.py +++ b/apps/assets/migrations/0115_auto_20230417_1425.py @@ -24,12 +24,6 @@ def migrate_automation_platform(apps, schema_editor): automation.save(update_fields=['platform']) -def migrate_null_platform_automation(apps, schema_editor): - automation_model = apps.get_model('assets', 'PlatformAutomation') - null_platform_automations = automation_model.objects.filter(platform__isnull=True) - null_platform_automations.delete() - - class Migration(migrations.Migration): dependencies = [ ('assets', '0114_baseautomation_params'), @@ -50,4 +44,5 @@ class Migration(migrations.Migration): related_name='automation', to='assets.platform'), ), migrations.RunPython(migrate_automation_platform), + migrations.RemoveField(model_name='platform', name='_automation_id'), ] diff --git a/apps/assets/models/platform.py b/apps/assets/models/platform.py index 411b9ded4..030e54de3 100644 --- a/apps/assets/models/platform.py +++ b/apps/assets/models/platform.py @@ -101,7 +101,6 @@ class Platform(JMSBaseModel): su_enabled = models.BooleanField(default=False, verbose_name=_("Su enabled")) su_method = models.CharField(max_length=32, blank=True, null=True, verbose_name=_("Su method")) custom_fields = models.JSONField(null=True, default=list, verbose_name=_("Custom fields")) - _automation_id = models.UUIDField(null=True, editable=False) @property def type_constraints(self): From cff4309b0361529fc8936184c018f5a0b27e2248 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:42:46 +0800 Subject: [PATCH 05/48] fix: export assets (#10224) Co-authored-by: feng <1304903146@qq.com> --- apps/assets/serializers/asset/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 5bc0fbc2c..15958f17a 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -3,7 +3,7 @@ import re -from django.db.models import F +from django.db.models import F, QuerySet from django.db.transaction import atomic from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers @@ -200,7 +200,7 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali if not request: return default_field - if self.instance and isinstance(self.instance, list): + if self.instance and isinstance(self.instance, (QuerySet, list)): return default_field if not self.instance and uuid_pattern.findall(request.path): From 5a34372ca57d5c4147a3945d70851db62ed1f1e6 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 17 Apr 2023 17:46:10 +0800 Subject: [PATCH 06/48] =?UTF-8?q?perf:=20=E6=89=B9=E9=87=8F=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=B4=A6=E5=8F=B7=20=E6=B2=A1=E8=A7=A3=E5=AF=86=20(#1?= =?UTF-8?q?0226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/account.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 1827ed439..9ebbeda51 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -14,7 +14,7 @@ from assets.models import Asset from common.serializers import SecretReadableMixin from common.serializers.fields import ObjectRelatedField, LabeledChoiceField from common.utils import get_logger -from .base import BaseAccountSerializer +from .base import BaseAccountSerializer, AuthValidateMixin logger = get_logger(__name__) @@ -228,7 +228,9 @@ class AssetAccountBulkSerializerResultSerializer(serializers.Serializer): changed = serializers.BooleanField(read_only=True, label=_('Changed')) -class AssetAccountBulkSerializer(AccountCreateUpdateSerializerMixin, serializers.ModelSerializer): +class AssetAccountBulkSerializer( + AccountCreateUpdateSerializerMixin, AuthValidateMixin, serializers.ModelSerializer +): assets = serializers.PrimaryKeyRelatedField(queryset=Asset.objects, many=True, label=_('Assets')) class Meta: From faff0cd20a054e3ae14b27e3fab23adc340607b0 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 17 Apr 2023 18:54:55 +0800 Subject: [PATCH 07/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=86=85=E7=BD=AE=20platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/const/types.py | 8 +- .../migrations/0097_auto_20220426_1558.py | 1213 ++++++++++++++++- .../migrations/0111_auto_20230321_1633.py | 4 +- 3 files changed, 1219 insertions(+), 6 deletions(-) diff --git a/apps/assets/const/types.py b/apps/assets/const/types.py index a73b967b2..cdf421296 100644 --- a/apps/assets/const/types.py +++ b/apps/assets/const/types.py @@ -270,7 +270,7 @@ class AllTypes(ChoicesMixin): return data @classmethod - def create_or_update_by_platform_data(cls, name, platform_data, platform_cls=None): + def create_or_update_by_platform_data(cls, platform_data, platform_cls=None): # 不直接用 Platform 是因为可能在 migrations 中使用 from assets.models import Platform if platform_cls is None: @@ -279,6 +279,7 @@ class AllTypes(ChoicesMixin): automation_data = platform_data.pop('automation', {}) protocols_data = platform_data.pop('protocols', []) + name = platform_data['name'] platform, created = platform_cls.objects.update_or_create( defaults=platform_data, name=name ) @@ -294,7 +295,6 @@ class AllTypes(ChoicesMixin): platform.protocols.all().delete() for p in protocols_data: - p.pop('primary', None) platform.protocols.create(**p) @classmethod @@ -335,7 +335,7 @@ class AllTypes(ChoicesMixin): 'automation': {**default_automation, **_automation}, 'protocols': protocols_data } - cls.create_or_update_by_platform_data(name, platform_data, platform_cls=platform_cls) + cls.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls) @classmethod def update_user_create_platforms(cls, platform_cls): @@ -350,5 +350,5 @@ class AllTypes(ChoicesMixin): for platform in user_platforms: print("\t- Update platform: {}".format(platform.name)) platform_data = cls.get_type_default_platform(platform.category, platform.type) - cls.create_or_update_by_platform_data(platform.name, platform_data, platform_cls=platform_cls) + cls.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls) user_platforms.update(internal=False) diff --git a/apps/assets/migrations/0097_auto_20220426_1558.py b/apps/assets/migrations/0097_auto_20220426_1558.py index 59d9726e7..5a91f566f 100644 --- a/apps/assets/migrations/0097_auto_20220426_1558.py +++ b/apps/assets/migrations/0097_auto_20220426_1558.py @@ -1,12 +1,1223 @@ # Generated by Django 3.1.14 on 2022-04-26 07:58 +import json + from django.db import migrations + from assets.const import AllTypes +platforms_data_json = '''[ + { + "category": "host", + "type": "linux", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "Linux", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_posix", + "push_account_method": "push_account_posix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "linux", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "Gateway", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_posix", + "push_account_method": "push_account_posix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "unix", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "Unix", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_posix", + "push_account_method": "push_account_posix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "unix", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "macOS", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_posix", + "push_account_method": "push_account_posix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "unix", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "BSD", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_posix", + "push_account_method": "push_account_posix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "unix", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": true, + "name": "AIX", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "smart" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "posix_ping", + "gather_facts_method": "gather_facts_posix", + "gather_accounts_method": "gather_accounts_posix", + "verify_account_method": "verify_account_posix", + "change_secret_method": "change_secret_aix", + "push_account_method": "push_account_aix" + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + }, + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "required": false, + "default": false + } + ] + } + { + "category": "host", + "type": "windows", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Windows", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_shell_type": "cmd", + "ansible_connection": "ssh" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "win_ping", + "gather_facts_method": "gather_facts_windows", + "gather_accounts_method": "gather_accounts_windows", + "verify_account_method": "verify_account_windows", + "change_secret_method": "change_secret_local_windows", + "push_account_method": "push_account_local_windows" + }, + "protocols": [ + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "required": false, + "default": false + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "host", + "type": "windows", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Windows-TLS", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_shell_type": "cmd", + "ansible_connection": "ssh" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "win_ping", + "gather_facts_method": "gather_facts_windows", + "gather_accounts_method": "gather_accounts_windows", + "verify_account_method": "verify_account_windows", + "change_secret_method": "change_secret_local_windows", + "push_account_method": "push_account_local_windows" + }, + "protocols": [ + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "tls" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "required": false, + "default": false + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "host", + "type": "windows", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Windows-RDP", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_shell_type": "cmd", + "ansible_connection": "ssh" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "win_ping", + "gather_facts_method": "gather_facts_windows", + "gather_accounts_method": "gather_accounts_windows", + "verify_account_method": "verify_account_windows", + "change_secret_method": "change_secret_local_windows", + "push_account_method": "push_account_local_windows" + }, + "protocols": [ + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "rdp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "required": false, + "default": false + }, + { + "name": "vnc", + "port": 5900, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "host", + "type": "windows", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "RemoteAppHost", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_shell_type": "cmd", + "ansible_connection": "ssh" + }, + "ping_enabled": true, + "gather_facts_enabled": true, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "win_ping", + "gather_facts_method": "gather_facts_windows", + "gather_accounts_method": "gather_accounts_windows", + "verify_account_method": "verify_account_windows", + "change_secret_method": "change_secret_local_windows", + "push_account_method": "push_account_local_windows" + }, + "protocols": [ + { + "name": "rdp", + "port": 3389, + "setting": { + "console": false, + "security": "any" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "required": true, + "default": false + } + ] + } + { + "category": "device", + "type": "general", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "General", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "device", + "type": "general", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Cisco", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "device", + "type": "general", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Huawei", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "device", + "type": "general", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "H3C", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "ssh", + "port": 22, + "setting": { + "sftp_enabled": true, + "sftp_home": "/tmp" + }, + "primary": true, + "required": false, + "default": false + }, + { + "name": "telnet", + "port": 23, + "required": false, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "mysql", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "MySQL", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "mysql_ping", + "gather_accounts_method": "gather_accounts_mysql", + "verify_account_method": "verify_account_mysql", + "change_secret_method": "change_secret_mysql", + "push_account_method": "push_account_mysql" + }, + "protocols": [ + { + "name": "mysql", + "port": 3306, + "setting": {}, + "required": false, + "primary": true, + "default": false + } + ] + } + { + "category": "database", + "type": "mariadb", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "MariaDB", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "mysql_ping", + "gather_accounts_method": "gather_accounts_mysql", + "verify_account_method": "verify_account_mysql", + "change_secret_method": "change_secret_mysql", + "push_account_method": "push_account_mysql" + }, + "protocols": [ + { + "name": "mariadb", + "port": 3306, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "postgresql", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "PostgreSQL", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "ping_postgresql", + "gather_accounts_method": "gather_accounts_postgresql", + "verify_account_method": "verify_account_postgresql", + "change_secret_method": "change_secret_postgresql", + "push_account_method": "push_account_postgresql" + }, + "protocols": [ + { + "name": "postgresql", + "port": 5432, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "oracle", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Oracle", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "oracle_ping", + "gather_accounts_method": "gather_accounts_oracle", + "verify_account_method": "verify_account_oracle", + "change_secret_method": "change_secret_oracle", + "push_account_method": "push_account_oracle" + }, + "protocols": [ + { + "name": "oracle", + "port": 1521, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "sqlserver", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "SQLServer", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "sqlserver_ping", + "verify_account_method": "verify_account_sqlserver", + "change_secret_method": "change_secret_sqlserver", + "push_account_method": "push_account_sqlserver" + }, + "protocols": [ + { + "name": "sqlserver", + "port": 1433, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "clickhouse", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "ClickHouse", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "clickhouse", + "port": 9000, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "mongodb", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "MongoDB", + "automation": { + "ansible_enabled": true, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": true, + "gather_facts_enabled": false, + "gather_accounts_enabled": true, + "verify_account_enabled": true, + "change_secret_enabled": true, + "push_account_enabled": true, + "ansible_config_methods": [], + "ping_method": "mongodb_ping", + "gather_accounts_method": "gather_accounts_mongodb", + "verify_account_method": "verify_account_mongodb", + "change_secret_method": "change_secret_mongodb", + "push_account_method": "push_account_mongodb" + }, + "protocols": [ + { + "name": "mongodb", + "port": 27017, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } + { + "category": "database", + "type": "redis", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Redis", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "redis", + "port": 6379, + "required": false, + "setting": { + "auth_username": false + }, + "primary": true, + "default": false + } + ] + } + { + "category": "database", + "type": "redis", + "internal": true, + "charset": "utf-8", + "domain_enabled": true, + "su_enabled": false, + "name": "Redis6+", + "automation": { + "ansible_enabled": false, + "ansible_config": { + "ansible_connection": "local" + }, + "ping_enabled": false, + "gather_facts_enabled": false, + "gather_accounts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "ansible_config_methods": [] + }, + "protocols": [ + { + "name": "redis", + "port": 6379, + "required": false, + "setting": { + "auth_username": true + }, + "primary": true, + "default": false + } + ] + } + { + "category": "web", + "type": "website", + "internal": true, + "charset": "utf-8", + "domain_enabled": false, + "su_enabled": false, + "name": "Website", + "automation": { + "ansible_enabled": false, + "ping_enabled": false, + "gather_facts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "gather_accounts_enabled": false + }, + "protocols": [ + { + "name": "http", + "port": 80, + "setting": { + "username_selector": "name=username", + "password_selector": "name=password", + "submit_selector": "id=longin_button" + }, + "primary": true, + "required": false, + "default": false + } + ] + } + { + "category": "cloud", + "type": "private", + "internal": true, + "charset": "utf-8", + "domain_enabled": false, + "su_enabled": false, + "name": "Vmware-vSphere", + "automation": { + "ansible_enabled": false, + "ansible_config": {}, + "gather_facts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "gather_accounts_enabled": false + }, + "protocols": [ + { + "name": "http", + "port": 80, + "setting": { + "username_selector": "name=username", + "password_selector": "name=password", + "submit_selector": "id=longin_button" + }, + "primary": true, + "required": false, + "default": false + } + ] + } + { + "category": "cloud", + "type": "k8s", + "internal": true, + "charset": "utf-8", + "domain_enabled": false, + "su_enabled": false, + "name": "Kubernetes", + "automation": { + "ansible_enabled": false, + "ansible_config": {}, + "gather_facts_enabled": false, + "verify_account_enabled": false, + "change_secret_enabled": false, + "push_account_enabled": false, + "gather_accounts_enabled": false + }, + "protocols": [ + { + "name": "k8s", + "port": 443, + "required": false, + "primary": true, + "default": false, + "setting": {} + } + ] + } +]''' + def create_internal_platforms(apps, *args): platform_cls = apps.get_model('assets', 'Platform') - AllTypes.create_or_update_internal_platforms(platform_cls) + platforms_data = json.loads(platforms_data_json) + + 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) def update_user_platforms(apps, *args): diff --git a/apps/assets/migrations/0111_auto_20230321_1633.py b/apps/assets/migrations/0111_auto_20230321_1633.py index 52dbc1971..1acac984a 100644 --- a/apps/assets/migrations/0111_auto_20230321_1633.py +++ b/apps/assets/migrations/0111_auto_20230321_1633.py @@ -15,6 +15,9 @@ def migrate_platform_protocol_primary(apps, schema_editor): 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 @@ -45,5 +48,4 @@ class Migration(migrations.Migration): ), migrations.RunPython(migrate_platform_charset), migrations.RunPython(migrate_platform_protocol_primary), - migrations.RunPython(migrate_internal_platforms), ] From cad88560bb584cf2117fb4e71db56bf44591703f Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Tue, 18 Apr 2023 09:59:31 +0800 Subject: [PATCH 08/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9OAuth2=E7=9A=84?= =?UTF-8?q?access=5Ftoken=E5=89=8D=E7=BC=80=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/backends/oauth2/backends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/authentication/backends/oauth2/backends.py b/apps/authentication/backends/oauth2/backends.py index 59e5e432b..2214ba628 100644 --- a/apps/authentication/backends/oauth2/backends.py +++ b/apps/authentication/backends/oauth2/backends.py @@ -119,7 +119,7 @@ class OAuth2Backend(JMSModelBackend): headers = { 'Accept': 'application/json', - 'Authorization': 'token {}'.format(response_data.get('access_token', '')) + 'Authorization': 'Bearer {}'.format(response_data.get('access_token', '')) } logger.debug(log_prompt.format('Get userinfo endpoint')) From 810aff95970587adaf220fd329168d5442903ec2 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:32:59 +0800 Subject: [PATCH 09/48] =?UTF-8?q?perf:=20k8s=20=E6=94=AF=E6=8C=81=E7=BD=91?= =?UTF-8?q?=E5=85=B3=20(#10229)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/assets/utils/k8s.py | 61 +++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/apps/assets/utils/k8s.py b/apps/assets/utils/k8s.py index 8e12e8de8..892293f57 100644 --- a/apps/assets/utils/k8s.py +++ b/apps/assets/utils/k8s.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- -from urllib.parse import urlencode +from urllib.parse import urlencode, urlparse from kubernetes import client from kubernetes.client import api_client from kubernetes.client.api import core_v1_api from kubernetes.client.exceptions import ApiException +from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError from common.utils import get_logger from ..const import CloudTypes, Category @@ -13,16 +14,15 @@ logger = get_logger(__file__) class KubernetesClient: - def __init__(self, url, token, proxy=None): - self.url = url + def __init__(self, asset, token): + self.url = asset.address self.token = token - self.proxy = proxy + self.server = self.get_gateway_server(asset) @property def api(self): configuration = client.Configuration() configuration.host = self.url - configuration.proxy = self.proxy configuration.verify_ssl = False configuration.api_key = {"authorization": "Bearer " + self.token} c = api_client.ApiClient(configuration=configuration) @@ -51,27 +51,43 @@ class KubernetesClient: return containers @staticmethod - def get_proxy_url(asset): - if not asset.domain: - return None + def get_gateway_server(asset): + gateway = None + if not asset.is_gateway and asset.domain: + gateway = asset.domain.select_gateway() - gateway = asset.domain.select_gateway() if not gateway: - return None - return f'{gateway.address}:{gateway.port}' + return - @classmethod - def run(cls, asset, secret, tp, *args): - k8s_url = f'{asset.address}' - proxy_url = cls.get_proxy_url(asset) - k8s = cls(k8s_url, secret, proxy=proxy_url) + remote_bind_address = ( + urlparse(asset.address).hostname, + urlparse(asset.address).port + ) + server = SSHTunnelForwarder( + (gateway.address, gateway.port), + ssh_username=gateway.username, + ssh_password=gateway.password, + ssh_pkey=gateway.private_key_path, + remote_bind_address=remote_bind_address + ) + try: + server.start() + except BaseSSHTunnelForwarderError: + err_msg = 'Gateway is not active: %s' % asset.get('name', '') + print('\033[31m %s \033[0m\n' % err_msg) + return server + + def run(self, tp, *args): func_name = f'get_{tp}s' data = [] - if hasattr(k8s, func_name): + if hasattr(self, func_name): try: - data = getattr(k8s, func_name)(*args) + data = getattr(self, func_name)(*args) except ApiException as e: logger.error(e.reason) + + if self.server: + self.server.stop() return data @@ -131,10 +147,11 @@ class KubernetesTree: def async_tree_node(self, namespace, pod): tree = [] + k8s_client = KubernetesClient(self.asset, self.secret) if pod: tp = 'container' - containers = KubernetesClient.run( - self.asset, self.secret, tp, namespace, pod + containers = k8s_client.run( + tp, namespace, pod ) for container in containers: container_node = self.as_container_tree_node( @@ -143,13 +160,13 @@ class KubernetesTree: tree.append(container_node) elif namespace: tp = 'pod' - pods = KubernetesClient.run(self.asset, self.secret, tp, namespace) + pods = k8s_client.run(tp, namespace) for pod in pods: pod_node = self.as_pod_tree_node(namespace, pod, tp) tree.append(pod_node) else: tp = 'namespace' - namespaces = KubernetesClient.run(self.asset, self.secret, tp) + namespaces = k8s_client.run(tp) for namespace in namespaces: namespace_node = self.as_namespace_node(namespace, tp) tree.append(namespace_node) From ce38b2263c259e6b8ce35084381ea1c435775b12 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 14:02:24 +0800 Subject: [PATCH 10/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20platforms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/const/diff_internal.py | 52 +++++++++++++++++++ apps/assets/const/types.py | 12 +++-- .../migrations/0111_auto_20230321_1633.py | 45 ++++++++++++++-- 3 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 apps/assets/const/diff_internal.py diff --git a/apps/assets/const/diff_internal.py b/apps/assets/const/diff_internal.py new file mode 100644 index 000000000..3f47ee07b --- /dev/null +++ b/apps/assets/const/diff_internal.py @@ -0,0 +1,52 @@ +import difflib +import json +import sys + + +def diff_list(f1, f2): + with open(f1) as f: + data1 = json.load(f) + + data1_mapper = { + d['name']: d for d in data1 + } + with open(f2) as f: + data2 = json.load(f) + + data2_mapper = { + d['name']: d for d in data2 + } + + d1_names = set(data1_mapper.keys()) + d2_names = set(data2_mapper.keys()) + + diff_names = d1_names - d2_names + if diff_names: + print("Diff Names1: ", diff_names) + + diff_names = d2_names - d1_names + if diff_names: + print("Diff Names2: ", diff_names) + + for name, data in data1_mapper.items(): + if name not in data2_mapper: + continue + data2 = data2_mapper[name] + print("Diff: ", name) + diff = difflib.unified_diff( + json.dumps(data, indent=4, sort_keys=True).splitlines(), + json.dumps(data2, indent=4, sort_keys=True).splitlines() + ) + print('\n'.join(diff)) + print() + + +if __name__ == '__main__': + if len(sys.argv) != 3: + print('Usage: python diff.py file1 file2') + sys.exit(1) + + f1 = sys.argv[1] + f2 = sys.argv[2] + + diff = diff_list(f1, f2) diff --git a/apps/assets/const/types.py b/apps/assets/const/types.py index cdf421296..ce2ef8916 100644 --- a/apps/assets/const/types.py +++ b/apps/assets/const/types.py @@ -1,3 +1,4 @@ +import json from collections import defaultdict from copy import deepcopy @@ -302,20 +303,20 @@ class AllTypes(ChoicesMixin): if platform_cls is None: platform_cls = cls - print("\n\tCreate internal platforms") + # print("\n\tCreate internal platforms") for category, type_cls in cls.category_types(): - print("\t## Category: {}".format(category.label)) + # print("\t## Category: {}".format(category.label)) data = type_cls.internal_platforms() for tp, platform_datas in data.items(): - print("\t >> Type: {}".format(tp.label)) + # print("\t >> Type: {}".format(tp.label)) default_platform_data = cls.get_type_default_platform(category, tp) default_automation = default_platform_data.pop('automation', {}) default_protocols = default_platform_data.pop('protocols', []) for d in platform_datas: name = d['name'] - print("\t - Platform: {}".format(name)) + # print("\t - Platform: {}".format(name)) _automation = d.pop('automation', {}) _protocols = d.pop('_protocols', []) _protocols_setting = d.pop('protocols_setting', {}) @@ -335,7 +336,8 @@ class AllTypes(ChoicesMixin): 'automation': {**default_automation, **_automation}, 'protocols': protocols_data } - cls.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls) + print(json.dumps(platform_data, indent=4)) + # cls.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls) @classmethod def update_user_create_platforms(cls, platform_cls): diff --git a/apps/assets/migrations/0111_auto_20230321_1633.py b/apps/assets/migrations/0111_auto_20230321_1633.py index 1acac984a..2688287e5 100644 --- a/apps/assets/migrations/0111_auto_20230321_1633.py +++ b/apps/assets/migrations/0111_auto_20230321_1633.py @@ -2,8 +2,6 @@ from django.db import migrations, models -from assets.const import AllTypes - def migrate_platform_charset(apps, schema_editor): platform_model = apps.get_model('assets', 'Platform') @@ -25,9 +23,46 @@ def migrate_platform_protocol_primary(apps, schema_editor): p.save() -def migrate_internal_platforms(apps, schema_editor): +def migrate_winrm_for_win(apps, *args): platform_cls = apps.get_model('assets', 'Platform') - AllTypes.create_or_update_internal_platforms(platform_cls) + windows_name = ['Windows', 'Windows-TLS', 'Windows-RDP'] + windows = platform_cls.objects.filter(name__in=windows_name) + for platform in windows: + if platform.protocols.filter(name='winrm').exists(): + continue + data = { + 'name': 'winrm', + 'port': 5985, + 'primary': False, + 'public': False, + 'required': False, + 'default': False, + 'setting': {"use_ssl": False} + } + platform.protocols.create(**data) + + +def migrate_device_platform_automation(apps, *args): + platform_cls = apps.get_model('assets', 'Platform') + names = ['General', 'Cisco', 'H3C', 'Huawei'] + platforms = platform_cls.objects.filter(name__in=names, category='device') + + for platform in platforms: + automation = getattr(platform, 'automation', None) + if not automation: + continue + automation.ansible_config = { + "ansible_connection": "local", + "first_connect_delay": 0.5, + } + automation.ansible_enable = True + automation.change_secret_enabled = True + automation.change_secret_method = "change_secret_by_ssh" + automation.ping_enabled = True + automation.ping_method = "ping_by_ssh" + automation.verify_account_enabled = True + automation.verify_account_method = "verify_account_by_ssh" + automation.save() class Migration(migrations.Migration): @@ -48,4 +83,6 @@ class Migration(migrations.Migration): ), migrations.RunPython(migrate_platform_charset), migrations.RunPython(migrate_platform_protocol_primary), + migrations.RunPython(migrate_winrm_for_win), + migrations.RunPython(migrate_device_platform_automation), ] From bacda8248b9b2334ea1fc02e216766ca35e6c154 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 14:25:35 +0800 Subject: [PATCH 11/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E5=86=85?= =?UTF-8?q?=E7=BD=AE=20platform=20=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0097_auto_20220426_1558.py | 37 ++++--------------- {apps/assets/const => utils}/diff_internal.py | 0 2 files changed, 7 insertions(+), 30 deletions(-) rename {apps/assets/const => utils}/diff_internal.py (100%) diff --git a/apps/assets/migrations/0097_auto_20220426_1558.py b/apps/assets/migrations/0097_auto_20220426_1558.py index 5a91f566f..09371cfd3 100644 --- a/apps/assets/migrations/0097_auto_20220426_1558.py +++ b/apps/assets/migrations/0097_auto_20220426_1558.py @@ -26,7 +26,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -91,7 +90,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -156,7 +154,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -221,7 +218,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -286,7 +282,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -351,7 +346,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "posix_ping", "gather_facts_method": "gather_facts_posix", "gather_accounts_method": "gather_accounts_posix", @@ -417,7 +411,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "win_ping", "gather_facts_method": "gather_facts_windows", "gather_accounts_method": "gather_accounts_windows", @@ -476,7 +469,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "win_ping", "gather_facts_method": "gather_facts_windows", "gather_accounts_method": "gather_accounts_windows", @@ -535,7 +527,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "win_ping", "gather_facts_method": "gather_facts_windows", "gather_accounts_method": "gather_accounts_windows", @@ -594,7 +585,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "win_ping", "gather_facts_method": "gather_facts_windows", "gather_accounts_method": "gather_accounts_windows", @@ -644,8 +634,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -686,8 +675,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -728,8 +716,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -770,8 +757,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -813,7 +799,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "mysql_ping", "gather_accounts_method": "gather_accounts_mysql", "verify_account_method": "verify_account_mysql", @@ -850,7 +835,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "mysql_ping", "gather_accounts_method": "gather_accounts_mysql", "verify_account_method": "verify_account_mysql", @@ -887,7 +871,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "ping_postgresql", "gather_accounts_method": "gather_accounts_postgresql", "verify_account_method": "verify_account_postgresql", @@ -924,7 +907,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "oracle_ping", "gather_accounts_method": "gather_accounts_oracle", "verify_account_method": "verify_account_oracle", @@ -961,7 +943,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "sqlserver_ping", "verify_account_method": "verify_account_sqlserver", "change_secret_method": "change_secret_sqlserver", @@ -996,8 +977,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -1029,7 +1009,6 @@ platforms_data_json = '''[ "verify_account_enabled": true, "change_secret_enabled": true, "push_account_enabled": true, - "ansible_config_methods": [], "ping_method": "mongodb_ping", "gather_accounts_method": "gather_accounts_mongodb", "verify_account_method": "verify_account_mongodb", @@ -1065,8 +1044,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { @@ -1099,8 +1077,7 @@ platforms_data_json = '''[ "gather_accounts_enabled": false, "verify_account_enabled": false, "change_secret_enabled": false, - "push_account_enabled": false, - "ansible_config_methods": [] + "push_account_enabled": false }, "protocols": [ { diff --git a/apps/assets/const/diff_internal.py b/utils/diff_internal.py similarity index 100% rename from apps/assets/const/diff_internal.py rename to utils/diff_internal.py From b30e9aedceebb14e7d65fd2e366ad508de8bb9a6 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 15:06:22 +0800 Subject: [PATCH 12/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E5=B9=B3=E5=8F=B0=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/const/types.py | 1 + .../migrations/0097_auto_20220426_1558.py | 50 +++++++++---------- .../migrations/0111_auto_20230321_1633.py | 14 +++++- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/apps/assets/const/types.py b/apps/assets/const/types.py index ce2ef8916..ad26968a5 100644 --- a/apps/assets/const/types.py +++ b/apps/assets/const/types.py @@ -352,5 +352,6 @@ class AllTypes(ChoicesMixin): for platform in user_platforms: print("\t- Update platform: {}".format(platform.name)) platform_data = cls.get_type_default_platform(platform.category, platform.type) + platform_data['name'] = platform.name cls.create_or_update_by_platform_data(platform_data, platform_cls=platform_cls) user_platforms.update(internal=False) diff --git a/apps/assets/migrations/0097_auto_20220426_1558.py b/apps/assets/migrations/0097_auto_20220426_1558.py index 09371cfd3..3fdf648a1 100644 --- a/apps/assets/migrations/0097_auto_20220426_1558.py +++ b/apps/assets/migrations/0097_auto_20220426_1558.py @@ -70,7 +70,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "linux", @@ -134,7 +134,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "unix", @@ -198,7 +198,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "unix", @@ -262,7 +262,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "unix", @@ -326,7 +326,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "unix", @@ -390,7 +390,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "host", "type": "windows", @@ -448,7 +448,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "host", "type": "windows", @@ -506,7 +506,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "host", "type": "windows", @@ -564,7 +564,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "host", "type": "windows", @@ -615,7 +615,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "device", "type": "general", @@ -656,7 +656,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "device", "type": "general", @@ -697,7 +697,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "device", "type": "general", @@ -738,7 +738,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "device", "type": "general", @@ -779,7 +779,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "mysql", @@ -815,7 +815,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "database", "type": "mariadb", @@ -851,7 +851,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "postgresql", @@ -887,7 +887,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "oracle", @@ -923,7 +923,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "sqlserver", @@ -958,7 +958,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "clickhouse", @@ -989,7 +989,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "mongodb", @@ -1025,7 +1025,7 @@ platforms_data_json = '''[ "setting": {} } ] - } + }, { "category": "database", "type": "redis", @@ -1058,7 +1058,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "database", "type": "redis", @@ -1091,7 +1091,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "web", "type": "website", @@ -1123,7 +1123,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "cloud", "type": "private", @@ -1155,7 +1155,7 @@ platforms_data_json = '''[ "default": false } ] - } + }, { "category": "cloud", "type": "k8s", diff --git a/apps/assets/migrations/0111_auto_20230321_1633.py b/apps/assets/migrations/0111_auto_20230321_1633.py index 2688287e5..e9f19ea0e 100644 --- a/apps/assets/migrations/0111_auto_20230321_1633.py +++ b/apps/assets/migrations/0111_auto_20230321_1633.py @@ -55,7 +55,7 @@ def migrate_device_platform_automation(apps, *args): "ansible_connection": "local", "first_connect_delay": 0.5, } - automation.ansible_enable = True + automation.ansible_enabled = True automation.change_secret_enabled = True automation.change_secret_method = "change_secret_by_ssh" automation.ping_enabled = True @@ -65,6 +65,17 @@ def migrate_device_platform_automation(apps, *args): automation.save() +def migrate_web_login_button_error(apps, *args): + protocol_cls = apps.get_model('assets', 'PlatformProtocol') + protocols = protocol_cls.objects.filter(name='http') + + for protocol in protocols: + submit_selector = protocol.setting.get('submit_selector', '') + submit_selector = submit_selector.replace('id=longin_button', 'id=login_button') + protocol.setting['submit_selector'] = submit_selector + protocol.save() + + class Migration(migrations.Migration): dependencies = [ ('assets', '0110_auto_20230315_1741'), @@ -85,4 +96,5 @@ class Migration(migrations.Migration): migrations.RunPython(migrate_platform_protocol_primary), migrations.RunPython(migrate_winrm_for_win), migrations.RunPython(migrate_device_platform_automation), + migrations.RunPython(migrate_web_login_button_error), ] From 0856b0cbbe7f2433a17132368da814d04c58faff Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:31:47 +0800 Subject: [PATCH 13/48] =?UTF-8?q?fix:=20k8s=20=E6=97=A0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=99=BB=E5=BD=95=20(#10233)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/assets/utils/k8s.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/assets/utils/k8s.py b/apps/assets/utils/k8s.py index 892293f57..a281bfe80 100644 --- a/apps/assets/utils/k8s.py +++ b/apps/assets/utils/k8s.py @@ -16,7 +16,7 @@ logger = get_logger(__file__) class KubernetesClient: def __init__(self, asset, token): self.url = asset.address - self.token = token + self.token = token or '' self.server = self.get_gateway_server(asset) @property From 5921b2ee8f0d87b22ea05d624b920913978863c4 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 16:29:41 +0800 Subject: [PATCH 14/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/serializers/account/account.py | 2 +- apps/assets/serializers/asset/common.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 9ebbeda51..4dd6bf041 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -59,7 +59,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): def set_uniq_name_if_need(self, initial_data, asset): name = initial_data.get('name') - if name is None: + if name is not None: return if not name: name = initial_data.get('username') diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 15958f17a..568450ec4 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -267,12 +267,13 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali nodes_display = self.initial_data.get('nodes_display') if nodes_display: return nodes + default_node = Node.org_root() request = self.context.get('request') if not request: - return [] + return [default_node] node_id = request.query_params.get('node_id') if not node_id: - return [] + return [default_node] nodes = Node.objects.filter(id=node_id) return nodes From cf197f7efc51aee991b7a9e5115f8d31b6b0132a Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:03:49 +0800 Subject: [PATCH 15/48] =?UTF-8?q?perf:=20=E5=88=9B=E5=BB=BA=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E9=80=9A=E8=BF=87=E8=B4=A6=E5=8F=B7=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=B4=A6=E5=8F=B7=20(#10234)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/account.py | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 9ebbeda51..0a3bd7131 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -34,6 +34,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): choices=AccountInvalidPolicy.choices, default=AccountInvalidPolicy.ERROR, write_only=True, label=_('Exist policy') ) + _template = None class Meta: fields = ['template', 'push_now', 'params', 'on_invalid'] @@ -69,9 +70,8 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): name = name + '_' + uuid.uuid4().hex[:4] initial_data['name'] = name - @staticmethod - def from_template_if_need(initial_data): - template_id = initial_data.get('template') + def from_template_if_need(self, initial_data): + template_id = initial_data.pop('template', None) if not template_id: return if isinstance(template_id, (str, uuid.UUID)): @@ -81,6 +81,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): if not template: raise serializers.ValidationError({'template': 'Template not found'}) + self._template = template # Set initial data from template ignore_fields = ['id', 'date_created', 'date_updated', 'org_id'] field_names = [ @@ -137,20 +138,17 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): else: raise serializers.ValidationError('Account already exists') - def validate(self, attrs): - attrs = super().validate(attrs) - if self.instance: - return attrs - - template = attrs.pop('template', None) - if template: - attrs['source'] = Source.TEMPLATE - attrs['source_id'] = str(template.id) - return attrs + def generate_source_data(self, validated_data): + template = self._template + if template is None: + return + validated_data['source'] = Source.TEMPLATE + validated_data['source_id'] = str(template.id) def create(self, validated_data): push_now = validated_data.pop('push_now', None) params = validated_data.pop('params', None) + self.generate_source_data(validated_data) instance, stat = self.do_create(validated_data) self.push_account_if_need(instance, push_now, params, stat) return instance @@ -368,6 +366,7 @@ class AssetAccountBulkSerializer( def create(self, validated_data): push_now = validated_data.pop('push_now', False) + self.generate_source_data(validated_data) results = self.perform_bulk_create(validated_data) self.push_accounts_if_need(results, push_now) for res in results: From 8b98bbddaa5b57ac3f795ca5e1384668f3a8dba3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 17:07:01 +0800 Subject: [PATCH 16/48] =?UTF-8?q?perf:=20custom=20fields=20=E4=BB=85custom?= =?UTF-8?q?=20=E7=B1=BB=E5=9E=8B=E8=B5=84=E4=BA=A7=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/asset/common.py | 51 +++++-------------------- apps/assets/serializers/asset/custom.py | 41 +++++++++++++++++++- apps/common/const/common.py | 3 ++ apps/common/serializers/common.py | 8 +++- apps/common/serializers/fields.py | 2 +- 5 files changed, 60 insertions(+), 45 deletions(-) diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 568450ec4..db248e5ef 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- # -import re - -from django.db.models import F, QuerySet +from django.db.models import F from django.db.transaction import atomic from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from accounts.models import Account from accounts.serializers import AccountSerializer -from common.serializers import WritableNestedModelSerializer, SecretReadableMixin, CommonModelSerializer, \ - MethodSerializer -from common.serializers.dynamic import create_serializer_class +from common.const import UUID_PATTERN +from common.serializers import ( + WritableNestedModelSerializer, SecretReadableMixin, + CommonModelSerializer, MethodSerializer +) from common.serializers.fields import LabeledChoiceField from orgs.mixins.serializers import BulkOrgResourceModelSerializer from ...const import Category, AllTypes @@ -25,8 +25,6 @@ __all__ = [ 'AccountSecretSerializer', 'AssetProtocolsPermsSerializer' ] -uuid_pattern = re.compile(r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}') - class AssetProtocolsSerializer(serializers.ModelSerializer): port = serializers.IntegerField(required=False, allow_null=True, max_value=65535, min_value=1) @@ -121,12 +119,11 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali protocols = AssetProtocolsSerializer(many=True, required=False, label=_('Protocols'), default=()) accounts = AssetAccountSerializer(many=True, required=False, allow_null=True, write_only=True, label=_('Account')) nodes_display = serializers.ListField(read_only=False, required=False, label=_("Node path")) - custom_info = MethodSerializer(label=_('Custom info')) class Meta: model = Asset fields_mini = ['id', 'name', 'address'] - fields_small = fields_mini + ['custom_info', 'is_active', 'comment'] + fields_small = fields_mini + ['is_active', 'comment'] fields_fk = ['domain', 'platform'] fields_m2m = [ 'nodes', 'labels', 'protocols', @@ -193,36 +190,6 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali .annotate(type=F("platform__type")) return queryset - def get_custom_info_serializer(self): - request = self.context.get('request') - default_field = serializers.DictField(required=False, label=_('Custom info')) - - if not request: - return default_field - - if self.instance and isinstance(self.instance, (QuerySet, list)): - return default_field - - if not self.instance and uuid_pattern.findall(request.path): - pk = uuid_pattern.findall(request.path)[0] - self.instance = Asset.objects.filter(id=pk).first() - - platform = None - if self.instance: - platform = self.instance.platform - elif request.query_params.get('platform'): - platform_id = request.query_params.get('platform') - platform_id = int(platform_id) if platform_id.isdigit() else 0 - platform = Platform.objects.filter(id=platform_id).first() - - if not platform: - return default_field - custom_fields = platform.custom_fields - if not custom_fields: - return default_field - name = platform.name.title() + 'CustomSerializer' - return create_serializer_class(name, custom_fields)() - @staticmethod def perform_nodes_display_create(instance, nodes_display): if not nodes_display: @@ -336,8 +303,8 @@ class DetailMixin(serializers.Serializer): def get_instance(self): request = self.context.get('request') - if not self.instance and uuid_pattern.findall(request.path): - pk = uuid_pattern.findall(request.path)[0] + if not self.instance and UUID_PATTERN.findall(request.path): + pk = UUID_PATTERN.findall(request.path)[0] self.instance = Asset.objects.filter(id=pk).first() return self.instance diff --git a/apps/assets/serializers/asset/custom.py b/apps/assets/serializers/asset/custom.py index d88024218..5e5cd774c 100644 --- a/apps/assets/serializers/asset/custom.py +++ b/apps/assets/serializers/asset/custom.py @@ -1,9 +1,48 @@ -from assets.models import Custom +from django.db.models import QuerySet +from django.utils.translation import gettext_lazy as _ +from rest_framework import serializers + +from assets.models import Custom, Platform, Asset +from common.const import UUID_PATTERN +from common.serializers import MethodSerializer, create_serializer_class from .common import AssetSerializer __all__ = ['CustomSerializer'] class CustomSerializer(AssetSerializer): + custom_info = MethodSerializer(label=_('Custom info')) + class Meta(AssetSerializer.Meta): model = Custom + fields = AssetSerializer.Meta.fields + ['custom_info'] + + def get_custom_info_serializer(self): + request = self.context.get('request') + default_field = serializers.DictField(required=False, label=_('Custom info')) + + if not request: + return default_field + + if self.instance and isinstance(self.instance, (QuerySet, list)): + return default_field + + if not self.instance and UUID_PATTERN.findall(request.path): + pk = UUID_PATTERN.findall(request.path)[0] + self.instance = Asset.objects.filter(id=pk).first() + + platform = None + if self.instance: + platform = self.instance.platform + elif request.query_params.get('platform'): + platform_id = request.query_params.get('platform') + platform_id = int(platform_id) if platform_id.isdigit() else 0 + platform = Platform.objects.filter(id=platform_id).first() + + if not platform: + return default_field + custom_fields = platform.custom_fields + if not custom_fields: + return default_field + name = platform.name.title() + 'CustomSerializer' + return create_serializer_class(name, custom_fields)() diff --git a/apps/common/const/common.py b/apps/common/const/common.py index 86ae030d9..33a889ecb 100644 --- a/apps/common/const/common.py +++ b/apps/common/const/common.py @@ -1,3 +1,5 @@ +import re + from django.utils.translation import ugettext_lazy as _ create_success_msg = _("%(name)s was created successfully") @@ -9,3 +11,4 @@ KEY_CACHE_RESOURCE_IDS = "RESOURCE_IDS_{}" # AD User AccountDisable # https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties LDAP_AD_ACCOUNT_DISABLE = 2 +UUID_PATTERN = re.compile(r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}') diff --git a/apps/common/serializers/common.py b/apps/common/serializers/common.py index 1515fe911..208023ac4 100644 --- a/apps/common/serializers/common.py +++ b/apps/common/serializers/common.py @@ -1,3 +1,5 @@ +import logging + from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from drf_writable_nested.serializers import WritableNestedModelSerializer as NestedModelSerializer @@ -35,7 +37,11 @@ class MethodSerializer(serializers.Serializer): @cached_property def serializer(self) -> serializers.Serializer: method = getattr(self.parent, self.method_name) - _serializer = method() + try: + _serializer = method() + except Exception as e: + logging.error(e, exc_info=True) + raise e # 设置serializer的parent值,否则在serializer实例中获取parent会出现断层 setattr(_serializer, 'parent', self.parent) return _serializer diff --git a/apps/common/serializers/fields.py b/apps/common/serializers/fields.py index 514a96fd0..e8a350023 100644 --- a/apps/common/serializers/fields.py +++ b/apps/common/serializers/fields.py @@ -63,7 +63,7 @@ class LabeledChoiceField(ChoiceField): def to_representation(self, key): if key is None: return key - label = self.choice_mapper.get(key) + label = self.choice_mapper.get(key, key) return {"value": key, "label": label} def to_internal_value(self, data): From a28239f313d5ec024530278b9e0d85d786ecba5b Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:07:54 +0800 Subject: [PATCH 17/48] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E5=A4=8D?= =?UTF-8?q?=E6=A0=B8=E5=88=B7=E6=96=B0=E5=90=8E404=20(#10240)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/authentication/api/login_confirm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/authentication/api/login_confirm.py b/apps/authentication/api/login_confirm.py index d2e5eb14e..7802b5b34 100644 --- a/apps/authentication/api/login_confirm.py +++ b/apps/authentication/api/login_confirm.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- # +from django.contrib.auth import logout as auth_logout +from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework.views import APIView -from rest_framework.permissions import AllowAny from common.utils import get_logger from .. import errors, mixins -from django.contrib.auth import logout as auth_logout - __all__ = ['TicketStatusApi'] logger = get_logger(__name__) @@ -26,8 +25,10 @@ class TicketStatusApi(mixins.AuthMixin, APIView): reason = e.msg username = e.username self.send_auth_signal(success=False, username=username, reason=reason) + auth_ticket_id = request.session.pop('auth_ticket_id', '') # 若为三方登录,此时应退出登录 auth_logout(request) + request.session['auth_ticket_id'] = auth_ticket_id return Response(e.as_data(), status=200) except errors.NeedMoreInfoError as e: return Response(e.as_data(), status=200) From f47d0b1a407096423c36fbed806f4f8c1496cf68 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:56:17 +0800 Subject: [PATCH 18/48] =?UTF-8?q?perf:=20=E5=B7=A5=E5=8D=95=E5=8F=91?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=A4=B1=E8=B4=A5=20(#10242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/common/db/encoder.py | 10 +++++----- apps/tickets/notifications.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/common/db/encoder.py b/apps/common/db/encoder.py index e09ffd60e..d773491a1 100644 --- a/apps/common/db/encoder.py +++ b/apps/common/db/encoder.py @@ -1,12 +1,12 @@ import json -import uuid import logging +import uuid from datetime import datetime -from django.utils.translation import ugettext_lazy as _ -from django.utils import timezone as dj_timezone -from django.db import models from django.conf import settings +from django.db import models +from django.utils import timezone as dj_timezone +from django.utils.translation import ugettext_lazy as _ lazy_type = type(_('ugettext_lazy')) @@ -28,5 +28,5 @@ class ModelJSONFieldEncoder(json.JSONEncoder): try: return super().default(obj) except TypeError: - logging.error('Type error: ', type(obj)) + logging.error(f'Type error: {type(obj)}') return str(obj) diff --git a/apps/tickets/notifications.py b/apps/tickets/notifications.py index 7e971f4cf..5da077496 100644 --- a/apps/tickets/notifications.py +++ b/apps/tickets/notifications.py @@ -3,16 +3,16 @@ from urllib.parse import urljoin from django.conf import settings from django.core.cache import cache -from django.shortcuts import reverse from django.forms import model_to_dict +from django.shortcuts import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ -from notifications.notifications import UserMessage -from common.utils import get_logger, random_string from common.db.encoder import ModelJSONFieldEncoder -from .models import Ticket +from common.utils import get_logger, random_string +from notifications.notifications import UserMessage from . import const +from .models import Ticket logger = get_logger(__file__) From 389f94d6723a2dfa0398539d90fbac62dd398a42 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 19:07:01 +0800 Subject: [PATCH 19/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20assets=20ser?= =?UTF-8?q?ializer=20=E6=94=AF=E6=8C=81=20accounts=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/serializers/account/account.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 5ce42d412..f92f7d93d 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -58,6 +58,10 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): self.from_template_if_need(data) self.set_uniq_name_if_need(data, asset) + def to_internal_value(self, data): + self.from_template_if_need(data) + return super().to_internal_value(data) + def set_uniq_name_if_need(self, initial_data, asset): name = initial_data.get('name') if name is not None: @@ -74,6 +78,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): template_id = initial_data.pop('template', None) if not template_id: return + if isinstance(template_id, (str, uuid.UUID)): template = AccountTemplate.objects.filter(id=template_id).first() else: From a83d1c7c46fc9a384543e486f9bc5ad7839b63c3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 18 Apr 2023 17:32:28 +0800 Subject: [PATCH 20/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20applet=20hos?= =?UTF-8?q?t=20platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0116_auto_20230418_1726.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 apps/assets/migrations/0116_auto_20230418_1726.py diff --git a/apps/assets/migrations/0116_auto_20230418_1726.py b/apps/assets/migrations/0116_auto_20230418_1726.py new file mode 100644 index 000000000..e15a5cdc0 --- /dev/null +++ b/apps/assets/migrations/0116_auto_20230418_1726.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.17 on 2023-04-18 09:26 + +from django.db import migrations + + +def update_remote_app_platform(apps, schema_editor): + platform_cls = apps.get_model('assets', 'Platform') + remote_app_host = platform_cls.objects.filter(name='RemoteAppHost').first() + if not remote_app_host: + return + + protocols = remote_app_host.protocols.all() + for protocol in protocols: + if protocol.name == 'rdp': + protocol.primary = True + protocol.save() + elif protocol.name == 'ssh': + protocol.required = True + protocol.save() + + +class Migration(migrations.Migration): + dependencies = [ + ('assets', '0115_auto_20230417_1425'), + ] + + operations = [ + migrations.RunPython(update_remote_app_platform) + ] From 50421a1f890130d01d8d7c8d6bcbe38512d263e8 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Tue, 18 Apr 2023 19:33:20 +0800 Subject: [PATCH 21/48] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E4=B8=AD=E5=BF=83=E9=80=89=E6=8B=A9=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=8F=96=E4=B8=8D=E5=88=B0=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/serializers/job.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/ops/serializers/job.py b/apps/ops/serializers/job.py index 5e714976d..cc690d812 100644 --- a/apps/ops/serializers/job.py +++ b/apps/ops/serializers/job.py @@ -39,7 +39,12 @@ class JobSerializer(BulkOrgResourceModelSerializer, PeriodTaskSerializerMixin): user = self.get_request_user() perm_util = UserPermAssetUtil(user=user) for node_id in node_ids: - node, node_assets = perm_util.get_node_all_assets(node_id) + if node_id == 'favorite': + node_assets = perm_util.get_favorite_assets() + elif node_id == 'ungroup': + node_assets = perm_util.get_ungroup_assets() + else: + node, node_assets = perm_util.get_node_all_assets(node_id) assets.extend(node_assets.exclude(id__in=[asset.id for asset in assets])) return super().create(validated_data) From ca898ed7b5cd96b5d52e6ed6c39f25391cbc4f43 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Tue, 18 Apr 2023 19:51:36 +0800 Subject: [PATCH 22/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/serializers/job.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ops/serializers/job.py b/apps/ops/serializers/job.py index cc690d812..8b157b66f 100644 --- a/apps/ops/serializers/job.py +++ b/apps/ops/serializers/job.py @@ -4,6 +4,7 @@ from django.utils.translation import gettext_lazy as _ from rest_framework import serializers from assets.models import Node, Asset +from perms.models import PermNode from perms.utils.user_perm import UserPermAssetUtil from common.serializers.fields import ReadableHiddenField from ops.mixin import PeriodTaskSerializerMixin @@ -39,9 +40,9 @@ class JobSerializer(BulkOrgResourceModelSerializer, PeriodTaskSerializerMixin): user = self.get_request_user() perm_util = UserPermAssetUtil(user=user) for node_id in node_ids: - if node_id == 'favorite': + if node_id == PermNode.FAVORITE_NODE_KEY: node_assets = perm_util.get_favorite_assets() - elif node_id == 'ungroup': + elif node_id == PermNode.UNGROUPED_NODE_KEY: node_assets = perm_util.get_ungroup_assets() else: node, node_assets = perm_util.get_node_all_assets(node_id) From 28f08251b3d550140c099d52c7fcadc8d7e95cef Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 20:10:51 +0800 Subject: [PATCH 23/48] =?UTF-8?q?perf:=20=E4=BF=AE=E5=A4=8D=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=B5=84=E4=BA=A7=E6=97=B6=EF=BC=8Caccount=20?= =?UTF-8?q?=E7=9A=84=E6=A0=A1=E9=AA=8C=20(#10247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: 修复创建资产时,account 的校验 * perf: 优化一下提示 --------- Co-authored-by: ibuler --- apps/accounts/serializers/account/account.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index f92f7d93d..72576b548 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -53,7 +53,7 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): for data in initial_data: if not data.get('asset') and not self.instance: - raise serializers.ValidationError({'asset': 'Asset is required'}) + raise serializers.ValidationError({'asset': UniqueTogetherValidator.missing_message}) asset = data.get('asset') or self.instance.asset self.from_template_if_need(data) self.set_uniq_name_if_need(data, asset) @@ -111,8 +111,9 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): _validators = super().get_validators() if getattr(self, 'initial_data', None) is None: return _validators + on_invalid = self.initial_data.get('on_invalid') - if on_invalid == AccountInvalidPolicy.ERROR: + if on_invalid == AccountInvalidPolicy.ERROR and not self.parent: return _validators _validators = [v for v in _validators if not isinstance(v, UniqueTogetherValidator)] return _validators From d402780d00627efe4cce5b6f5d38acb160b942ac Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 18 Apr 2023 20:21:37 +0800 Subject: [PATCH 24/48] =?UTF-8?q?feat:=20=E6=9C=8D=E5=8A=A1=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E6=A0=A1=E9=AA=8C=20migrations=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=98=AF=E5=90=A6=E6=9C=89=E5=86=B2=E7=AA=81(DEBUG=5F?= =?UTF-8?q?DEV)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/signal_handlers.py | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/apps/common/signal_handlers.py b/apps/common/signal_handlers.py index 6beb2d187..752682c51 100644 --- a/apps/common/signal_handlers.py +++ b/apps/common/signal_handlers.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # import logging +import os import re from collections import defaultdict @@ -12,6 +13,7 @@ from django.dispatch import receiver from jumpserver.utils import get_current_request from .local import thread_local +from .signals import django_ready pattern = re.compile(r'FROM `(\w+)`') logger = logging.getLogger("jumpserver.common") @@ -123,3 +125,56 @@ if settings.DEBUG_DEV: request_finished.connect(on_request_finished_logging_db_query) else: request_finished.connect(on_request_finished_release_local) + + +@receiver(django_ready) +def check_migrations_file_prefix_conflict(*args, **kwargs): + + if not settings.DEBUG_DEV: + return + + from jumpserver.const import BASE_DIR + print('>>> Check migrations file prefix conflict') + # 指定 app 目录 + _dir = BASE_DIR + # 获取所有子目录 + sub_dirs = next(os.walk(_dir))[1] + # 记录冲突的文件,元素为 (subdir, file1, file2) + conflict_files = [] + + # 遍历每个子目录 + for subdir in sub_dirs: + # 拼接 migrations 目录路径 + migrations_dir = os.path.join(_dir, subdir, 'migrations') + # 判断是否存在 migrations 目录 + if not os.path.exists(migrations_dir): + continue + # 获取所有文件名 + files = os.listdir(migrations_dir) + # 遍历每个文件名 + prefix_file_map = dict() + for file in files: + file = str(file) + # 判断是否为 Python 文件 + if not file.endswith('.py'): + continue + if 'squashed' in file: + continue + # file 为文件名 + file_prefix = file.split('_')[0] + if file_prefix in prefix_file_map.keys(): + conflict_files.append((subdir, file, prefix_file_map.get(file_prefix))) + else: + prefix_file_map[file_prefix] = file + + print('='*80) + print(f'Conflict count:({len(conflict_files)})') + for conflict_file in conflict_files: + msg_dir = '{:<15}'.format(conflict_file[0]) + msg_split = '=> ' + msg_left = msg_dir + msg_right1 = msg_split + '{:<80}'.format(conflict_file[1]) + msg_right2 = ' ' * len(msg_left) + msg_split + conflict_file[2] + print(f'{msg_left}{msg_right1}\n{msg_right2}\n') + + print('='*80) From 3bc8eda66a3710505d2ed66119f2e62ef00f8dad Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:18:13 +0800 Subject: [PATCH 25/48] =?UTF-8?q?perf:=20=E6=9B=B4=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E5=85=B3=E8=81=94=E6=9B=B4=E6=96=B0=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=20(#10250)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/template.py | 61 ++++++++++++++----- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/apps/accounts/serializers/account/template.py b/apps/accounts/serializers/account/template.py index 45190f051..e9804876b 100644 --- a/apps/accounts/serializers/account/template.py +++ b/apps/accounts/serializers/account/template.py @@ -1,3 +1,5 @@ +from django.db.utils import IntegrityError + from accounts.models import AccountTemplate, Account from assets.models import Asset from common.serializers import SecretReadableMixin @@ -9,37 +11,66 @@ class AccountTemplateSerializer(BaseAccountSerializer): model = AccountTemplate @staticmethod - def bulk_update_accounts(instance, diff): + def account_save(data, account): + for field, value in data.items(): + setattr(account, field, value) + try: + account.save(update_fields=list(data.keys())) + except IntegrityError: + pass + + # TODO 数据库访问的太多了 后期优化 + def bulk_update_accounts(self, instance, diff): accounts = Account.objects.filter(source_id=instance.id) if not accounts: return - secret_type = diff.pop('secret_type', None) diff.pop('secret', None) + name = diff.pop('name', None) + username = diff.pop('username', None) + secret_type = diff.pop('secret_type', None) update_accounts = [] for account in accounts: for field, value in diff.items(): setattr(account, field, value) update_accounts.append(account) + if update_accounts: Account.objects.bulk_update(update_accounts, diff.keys()) - if secret_type is None: - return + if name: + for account in accounts: + data = {'name': name} + self.account_save(data, account) - update_accounts = [] + if secret_type and username: + asset_ids_supports = self.get_asset_ids_supports(accounts, secret_type) + for account in accounts: + asset_id = account.asset_id + if asset_id not in asset_ids_supports: + data = {'username': username} + self.account_save(data, account) + continue + data = {'username': username, 'secret_type': secret_type, 'secret': instance.secret} + self.account_save(data, account) + elif secret_type: + asset_ids_supports = self.get_asset_ids_supports(accounts, secret_type) + for account in accounts: + asset_id = account.asset_id + if asset_id not in asset_ids_supports: + continue + data = {'secret_type': secret_type, 'secret': instance.secret} + self.account_save(data, account) + elif username: + for account in accounts: + data = {'username': username} + self.account_save(data, account) + + @staticmethod + def get_asset_ids_supports(accounts, secret_type): asset_ids = accounts.values_list('asset_id', flat=True) secret_type_supports = Asset.get_secret_type_assets(asset_ids, secret_type) - asset_ids_supports = [asset.id for asset in secret_type_supports] - for account in accounts: - asset_id = account.asset_id - if asset_id not in asset_ids_supports: - continue - account.secret_type = secret_type - account.secret = instance.secret - update_accounts.append(account) - if update_accounts: - Account.objects.bulk_update(update_accounts, ['secret', 'secret_type']) + return [asset.id for asset in secret_type_supports] def update(self, instance, validated_data): diff = { From fc4a77df1a69b345c46c5979a886798aacef7902 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:57:38 +0800 Subject: [PATCH 26/48] =?UTF-8?q?fix:=20=E8=B4=A6=E5=8F=B7=E5=AF=BC?= =?UTF-8?q?=E5=85=A5500=20(#10255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/account.py | 3 +++ apps/assets/serializers/asset/common.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 72576b548..d79fd69e4 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -75,6 +75,9 @@ class AccountCreateUpdateSerializerMixin(serializers.Serializer): initial_data['name'] = name def from_template_if_need(self, initial_data): + if isinstance(initial_data, str): + return + template_id = initial_data.pop('template', None) if not template_id: return diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index db248e5ef..9d3bcb097 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -70,9 +70,13 @@ class AssetPlatformSerializer(serializers.ModelSerializer): class AssetAccountSerializer(AccountSerializer): add_org_fields = False asset = serializers.PrimaryKeyRelatedField(queryset=Asset.objects, required=False, write_only=True) - clone_id: str + clone_id = None def to_internal_value(self, data): + # 导入时,data有时为str + if isinstance(data, str): + return super().to_internal_value(data) + clone_id = data.pop('id', None) ret = super().to_internal_value(data) self.clone_id = clone_id From 12adf66f41031d5a73f1ce00cc85df4c2f2774d3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 19 Apr 2023 10:37:46 +0800 Subject: [PATCH 27/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=8E=86=E5=8F=B2=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/api/account/account.py | 7 ++++++- ...gatheraccountsautomation_is_sync_account.py | 6 +++++- .../migrations/0011_account_source_id.py | 18 ------------------ apps/accounts/serializers/account/account.py | 1 + 4 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 apps/accounts/migrations/0011_account_source_id.py diff --git a/apps/accounts/api/account/account.py b/apps/accounts/api/account/account.py index 7b9991988..b25dafb9f 100644 --- a/apps/accounts/api/account/account.py +++ b/apps/accounts/api/account/account.py @@ -8,6 +8,7 @@ from accounts import serializers from accounts.filters import AccountFilterSet from accounts.models import Account from assets.models import Asset, Node +from common.api import ExtraFilterFieldsMixin from common.permissions import UserConfirmation, ConfirmType, IsValidUser from common.views.mixins import RecordViewLogMixin from orgs.mixins.api import OrgBulkModelViewSet @@ -111,7 +112,7 @@ class AssetAccountBulkCreateApi(CreateAPIView): return Response(data=serializer.data, status=HTTP_200_OK) -class AccountHistoriesSecretAPI(RecordViewLogMixin, ListAPIView): +class AccountHistoriesSecretAPI(ExtraFilterFieldsMixin, RecordViewLogMixin, ListAPIView): model = Account.history.model serializer_class = serializers.AccountHistorySerializer http_method_names = ['get', 'options'] @@ -123,6 +124,10 @@ class AccountHistoriesSecretAPI(RecordViewLogMixin, ListAPIView): def get_object(self): return get_object_or_404(Account, pk=self.kwargs.get('pk')) + @staticmethod + def filter_spm_queryset(resource_ids, queryset): + return queryset.filter(history_id__in=resource_ids) + def get_queryset(self): account = self.get_object() histories = account.history.all() diff --git a/apps/accounts/migrations/0010_gatheraccountsautomation_is_sync_account.py b/apps/accounts/migrations/0010_gatheraccountsautomation_is_sync_account.py index 058a7dd7e..259497692 100644 --- a/apps/accounts/migrations/0010_gatheraccountsautomation_is_sync_account.py +++ b/apps/accounts/migrations/0010_gatheraccountsautomation_is_sync_account.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('accounts', '0009_account_usernames_to_ids'), ] @@ -15,4 +14,9 @@ class Migration(migrations.Migration): name='is_sync_account', field=models.BooleanField(blank=True, default=False, verbose_name='Is sync account'), ), + migrations.AddField( + model_name='account', + name='source_id', + field=models.CharField(max_length=128, null=True, blank=True, verbose_name='Source ID'), + ), ] diff --git a/apps/accounts/migrations/0011_account_source_id.py b/apps/accounts/migrations/0011_account_source_id.py deleted file mode 100644 index ff9734404..000000000 --- a/apps/accounts/migrations/0011_account_source_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.17 on 2023-03-23 07:08 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('accounts', '0010_gatheraccountsautomation_is_sync_account'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='source_id', - field=models.CharField(max_length=128, null=True, blank=True, verbose_name='Source ID'), - ), - ] diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index d79fd69e4..c76cb1788 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -392,6 +392,7 @@ class AccountSecretSerializer(SecretReadableMixin, AccountSerializer): class AccountHistorySerializer(serializers.ModelSerializer): secret_type = LabeledChoiceField(choices=SecretType.choices, label=_('Secret type')) + id = serializers.IntegerField(label=_('ID'), source='history_id', read_only=True) class Meta: model = Account.history.model From 4849b2627ad063eeccbee951fecec7b3a5bc7d3c Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 19 Apr 2023 10:39:50 +0800 Subject: [PATCH 28/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/migrations/0115_auto_20230417_1425.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/assets/migrations/0115_auto_20230417_1425.py b/apps/assets/migrations/0115_auto_20230417_1425.py index 4995ac85e..34cd7ef2c 100644 --- a/apps/assets/migrations/0115_auto_20230417_1425.py +++ b/apps/assets/migrations/0115_auto_20230417_1425.py @@ -3,14 +3,15 @@ from django.db import migrations, models -def migrate_platform_automation_id(apps, schema_editor): +def migrate_platform_automation_id(apps, *args): platform_model = apps.get_model('assets', 'Platform') for platform in platform_model.objects.all(): - platform._automation_id = platform.automation.id - platform.save(update_fields=['_automation_id']) + if platform.automation: + platform._automation_id = platform.automation.id + platform.save(update_fields=['_automation_id']) -def migrate_automation_platform(apps, schema_editor): +def migrate_automation_platform(apps, *args): platform_model = apps.get_model('assets', 'Platform') automation_model = apps.get_model('assets', 'PlatformAutomation') platforms = platform_model.objects.all() From 9dedce6264718045b8e37024013cf4c417963747 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 19 Apr 2023 13:02:24 +0800 Subject: [PATCH 29/48] =?UTF-8?q?perf:=20=E7=BF=BB=E8=AF=91=20(#10257)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/assets/models/automations/base.py | 2 +- apps/locale/ja/LC_MESSAGES/django.mo | 4 +- apps/locale/ja/LC_MESSAGES/django.po | 700 +++++++++++++------------ apps/locale/zh/LC_MESSAGES/django.mo | 4 +- apps/locale/zh/LC_MESSAGES/django.po | 695 ++++++++++++------------ 5 files changed, 741 insertions(+), 664 deletions(-) diff --git a/apps/assets/models/automations/base.py b/apps/assets/models/automations/base.py index e41092fbf..ba9c3ffcb 100644 --- a/apps/assets/models/automations/base.py +++ b/apps/assets/models/automations/base.py @@ -19,7 +19,7 @@ class BaseAutomation(PeriodTaskModelMixin, JMSOrgBaseModel): assets = models.ManyToManyField('assets.Asset', blank=True, verbose_name=_("Assets")) type = models.CharField(max_length=16, verbose_name=_('Type')) is_active = models.BooleanField(default=True, verbose_name=_("Is active")) - params = models.JSONField(default=dict, verbose_name=_("Params")) + params = models.JSONField(default=dict, verbose_name=_("Parameters")) def __str__(self): return self.name + '@' + str(self.created_by) diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index 86fc7369d..44722ec8e 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:975e9e264596ef5f7233fc1d2fb45281a5fe13f5a722fc2b9d5c40562ada069d -size 138303 +oid sha256:aa23f3e706ba260d6f8123488e5a35b46a2d746ac35249f2b0b6bad042c75066 +size 138642 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 772fb0b5c..d95ccb443 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-07 13:57+0800\n" +"POT-Creation-Date: 2023-04-19 12:58+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -28,7 +28,7 @@ msgstr "パラメータ 'action' は [{}] でなければなりません。" #: authentication/confirm/password.py:9 authentication/forms.py:32 #: authentication/templates/authentication/login.html:274 #: settings/serializers/auth/ldap.py:25 settings/serializers/auth/ldap.py:47 -#: users/forms/profile.py:22 users/serializers/user.py:101 +#: users/forms/profile.py:22 users/serializers/user.py:105 #: users/templates/users/_msg_user_created.html:13 #: users/templates/users/user_password_verify.html:18 #: xpack/plugins/cloud/serializers/account_attrs.py:28 @@ -70,17 +70,22 @@ msgstr "ローカル" msgid "Collected" msgstr "" -#: accounts/const/account.py:24 ops/const.py:45 +#: accounts/const/account.py:21 accounts/serializers/account/account.py:25 +#: settings/serializers/auth/sms.py:75 +msgid "Template" +msgstr "テンプレート" + +#: accounts/const/account.py:25 ops/const.py:45 msgid "Skip" msgstr "スキップ" -#: accounts/const/account.py:25 audits/const.py:23 rbac/tree.py:229 +#: accounts/const/account.py:26 audits/const.py:23 rbac/tree.py:229 #: templates/_csv_import_export.html:18 templates/_csv_update_modal.html:6 msgid "Update" msgstr "更新" -#: accounts/const/account.py:26 -#: accounts/serializers/automations/change_secret.py:155 audits/const.py:53 +#: accounts/const/account.py:27 +#: accounts/serializers/automations/change_secret.py:156 audits/const.py:53 #: audits/signal_handlers/activity_log.py:33 common/const/choices.py:19 #: ops/const.py:58 terminal/const.py:60 xpack/plugins/cloud/const.py:41 msgid "Failed" @@ -176,16 +181,16 @@ msgstr "作成のみ" #: accounts/models/account.py:47 #: accounts/models/automations/gather_account.py:16 -#: accounts/serializers/account/account.py:173 -#: accounts/serializers/account/account.py:206 +#: accounts/serializers/account/account.py:199 +#: accounts/serializers/account/account.py:232 #: accounts/serializers/account/gathered_account.py:10 -#: accounts/serializers/automations/change_secret.py:111 -#: accounts/serializers/automations/change_secret.py:131 +#: accounts/serializers/automations/change_secret.py:112 +#: accounts/serializers/automations/change_secret.py:132 #: acls/models/base.py:100 acls/serializers/base.py:56 -#: assets/models/asset/common.py:92 assets/models/asset/common.py:268 +#: assets/models/asset/common.py:92 assets/models/asset/common.py:306 #: assets/models/cmd_filter.py:36 assets/serializers/domain.py:19 #: assets/serializers/label.py:27 audits/models.py:48 -#: authentication/models/connection_token.py:33 +#: authentication/models/connection_token.py:34 #: perms/models/asset_permission.py:64 perms/serializers/permission.py:34 #: terminal/backends/command/models.py:20 terminal/models/session/session.py:32 #: terminal/notifications.py:95 terminal/serializers/command.py:17 @@ -193,17 +198,17 @@ msgstr "作成のみ" msgid "Asset" msgstr "資産" -#: accounts/models/account.py:51 accounts/serializers/account/account.py:178 -#: authentication/serializers/connect_token_secret.py:48 +#: accounts/models/account.py:51 accounts/serializers/account/account.py:204 +#: authentication/serializers/connect_token_secret.py:49 msgid "Su from" msgstr "から切り替え" #: accounts/models/account.py:53 settings/serializers/auth/cas.py:20 -#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:29 +#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:28 msgid "Version" msgstr "バージョン" -#: accounts/models/account.py:55 accounts/serializers/account/account.py:174 +#: accounts/models/account.py:55 accounts/serializers/account/account.py:200 #: users/models/user.py:768 msgid "Source" msgstr "ソース" @@ -215,10 +220,10 @@ msgid "Source ID" msgstr "ソース" #: accounts/models/account.py:59 -#: accounts/serializers/automations/change_secret.py:112 -#: accounts/serializers/automations/change_secret.py:132 +#: accounts/serializers/automations/change_secret.py:113 +#: accounts/serializers/automations/change_secret.py:133 #: acls/models/base.py:102 acls/serializers/base.py:57 -#: assets/serializers/asset/common.py:107 assets/serializers/gateway.py:28 +#: assets/serializers/asset/common.py:124 assets/serializers/gateway.py:28 #: audits/models.py:49 ops/models/base.py:18 #: perms/models/asset_permission.py:70 perms/serializers/permission.py:39 #: terminal/backends/command/models.py:21 terminal/models/session/session.py:34 @@ -271,8 +276,8 @@ msgid "Account backup plan" msgstr "アカウントバックアップ計画" #: accounts/models/automations/backup_account.py:83 -#: assets/models/automations/base.py:114 audits/models.py:55 -#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:191 +#: assets/models/automations/base.py:115 audits/models.py:55 +#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:192 #: perms/models/asset_permission.py:72 terminal/models/applet/host.py:109 #: terminal/models/session/session.py:45 #: tickets/models/ticket/apply_application.py:30 @@ -293,7 +298,7 @@ msgstr "アカウントのバックアップスナップショット" #: accounts/models/automations/backup_account.py:94 #: accounts/serializers/account/backup.py:42 #: accounts/serializers/automations/base.py:55 -#: assets/models/automations/base.py:121 +#: assets/models/automations/base.py:122 #: assets/serializers/automations/base.py:40 msgid "Trigger mode" msgstr "トリガーモード" @@ -304,9 +309,9 @@ msgid "Reason" msgstr "理由" #: accounts/models/automations/backup_account.py:99 -#: accounts/serializers/automations/change_secret.py:110 -#: accounts/serializers/automations/change_secret.py:133 -#: ops/serializers/job.py:66 terminal/serializers/session.py:45 +#: accounts/serializers/automations/change_secret.py:111 +#: accounts/serializers/automations/change_secret.py:134 +#: ops/serializers/job.py:72 terminal/serializers/session.py:45 msgid "Is success" msgstr "成功は" @@ -351,11 +356,11 @@ msgid "Can add push account execution" msgstr "プッシュ アカウントの作成の実行" #: accounts/models/automations/change_secret.py:18 accounts/models/base.py:36 -#: accounts/serializers/account/account.py:383 +#: accounts/serializers/account/account.py:394 #: accounts/serializers/account/base.py:16 #: accounts/serializers/automations/change_secret.py:46 -#: authentication/serializers/connect_token_secret.py:40 -#: authentication/serializers/connect_token_secret.py:49 +#: authentication/serializers/connect_token_secret.py:41 +#: authentication/serializers/connect_token_secret.py:50 msgid "Secret type" msgstr "鍵の種類" @@ -394,14 +399,14 @@ msgid "Date started" msgstr "開始日" #: accounts/models/automations/change_secret.py:92 -#: assets/models/automations/base.py:115 ops/models/base.py:56 -#: ops/models/celery.py:64 ops/models/job.py:192 +#: assets/models/automations/base.py:116 ops/models/base.py:56 +#: ops/models/celery.py:64 ops/models/job.py:193 #: terminal/models/applet/host.py:110 msgid "Date finished" msgstr "終了日" #: accounts/models/automations/change_secret.py:94 -#: accounts/serializers/account/account.py:208 assets/const/automation.py:8 +#: accounts/serializers/account/account.py:234 assets/const/automation.py:8 #: common/const/choices.py:20 msgid "Error" msgstr "間違い" @@ -457,12 +462,12 @@ msgstr "トリガー方式" #: accounts/models/automations/push_account.py:16 acls/models/base.py:81 #: acls/serializers/base.py:81 acls/serializers/login_acl.py:25 #: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82 -#: authentication/serializers/connect_token_secret.py:107 +#: authentication/serializers/connect_token_secret.py:108 #: authentication/templates/authentication/_access_key_modal.html:34 msgid "Action" msgstr "アクション" -#: accounts/models/automations/push_account.py:59 +#: accounts/models/automations/push_account.py:60 msgid "Push asset account" msgstr "アカウントプッシュ" @@ -473,21 +478,21 @@ msgstr "アカウントの確認" #: accounts/models/base.py:33 acls/models/base.py:75 #: acls/models/command_acl.py:21 acls/serializers/base.py:34 #: applications/models.py:9 assets/models/_user.py:22 -#: assets/models/asset/common.py:90 assets/models/asset/common.py:102 +#: assets/models/asset/common.py:90 assets/models/asset/common.py:123 #: assets/models/cmd_filter.py:21 assets/models/domain.py:18 #: assets/models/group.py:20 assets/models/label.py:18 -#: assets/models/platform.py:13 assets/models/platform.py:65 -#: assets/serializers/asset/common.py:128 assets/serializers/platform.py:93 -#: assets/serializers/platform.py:184 -#: authentication/serializers/connect_token_secret.py:101 ops/mixin.py:21 +#: assets/models/platform.py:13 assets/models/platform.py:89 +#: assets/serializers/asset/common.py:144 assets/serializers/platform.py:99 +#: assets/serializers/platform.py:200 +#: authentication/serializers/connect_token_secret.py:102 ops/mixin.py:21 #: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57 -#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19 +#: ops/models/job.py:92 ops/models/playbook.py:23 ops/serializers/job.py:20 #: orgs/models.py:69 perms/models/asset_permission.py:56 rbac/models/role.py:29 #: settings/models.py:33 settings/serializers/sms.py:6 -#: terminal/models/applet/applet.py:27 terminal/models/component/endpoint.py:12 +#: terminal/models/applet/applet.py:26 terminal/models/component/endpoint.py:12 #: terminal/models/component/endpoint.py:90 #: terminal/models/component/storage.py:26 terminal/models/component/task.py:15 -#: terminal/models/component/terminal.py:85 users/forms/profile.py:33 +#: terminal/models/component/terminal.py:84 users/forms/profile.py:33 #: users/models/group.py:13 users/models/user.py:717 #: xpack/plugins/cloud/models.py:28 msgid "Name" @@ -497,11 +502,11 @@ msgstr "名前" msgid "Privileged" msgstr "特権アカウント" -#: accounts/models/base.py:40 assets/models/asset/common.py:109 +#: accounts/models/base.py:40 assets/models/asset/common.py:130 #: assets/models/automations/base.py:21 assets/models/cmd_filter.py:39 #: assets/models/label.py:22 -#: authentication/serializers/connect_token_secret.py:105 -#: terminal/models/applet/applet.py:32 users/serializers/user.py:162 +#: authentication/serializers/connect_token_secret.py:106 +#: terminal/models/applet/applet.py:31 users/serializers/user.py:169 msgid "Is active" msgstr "アクティブです。" @@ -546,39 +551,34 @@ msgstr "" "{} -暗号化変更タスクが完了しました: 暗号化パスワードが設定されていません-個人" "情報にアクセスしてください-> ファイル暗号化パスワードを設定してください" -#: accounts/serializers/account/account.py:26 -#: settings/serializers/auth/sms.py:75 -msgid "Template" -msgstr "テンプレート" - -#: accounts/serializers/account/account.py:29 +#: accounts/serializers/account/account.py:28 msgid "Push now" msgstr "今すぐプッシュ" -#: accounts/serializers/account/account.py:33 +#: accounts/serializers/account/account.py:35 #, fuzzy #| msgid "Runas policy" msgid "Exist policy" msgstr "ユーザー ポリシー" -#: accounts/serializers/account/account.py:153 applications/models.py:11 -#: assets/models/label.py:21 assets/models/platform.py:66 -#: assets/serializers/asset/common.py:103 assets/serializers/cagegory.py:8 -#: assets/serializers/platform.py:111 assets/serializers/platform.py:185 +#: accounts/serializers/account/account.py:179 applications/models.py:11 +#: assets/models/label.py:21 assets/models/platform.py:90 +#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8 +#: assets/serializers/platform.py:117 assets/serializers/platform.py:201 #: perms/serializers/user_permission.py:26 settings/models.py:35 #: tickets/models/ticket/apply_application.py:13 msgid "Category" msgstr "カテゴリ" -#: accounts/serializers/account/account.py:154 +#: accounts/serializers/account/account.py:180 #: accounts/serializers/automations/base.py:54 acls/models/command_acl.py:24 #: acls/serializers/command_acl.py:18 applications/models.py:14 #: assets/models/_user.py:50 assets/models/automations/base.py:20 -#: assets/models/cmd_filter.py:74 assets/models/platform.py:67 -#: assets/serializers/asset/common.py:104 assets/serializers/platform.py:95 -#: assets/serializers/platform.py:110 audits/serializers.py:48 -#: authentication/serializers/connect_token_secret.py:114 ops/models/job.py:102 -#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31 +#: assets/models/cmd_filter.py:74 assets/models/platform.py:91 +#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:101 +#: assets/serializers/platform.py:116 audits/serializers.py:48 +#: authentication/serializers/connect_token_secret.py:115 ops/models/job.py:103 +#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:30 #: terminal/models/component/storage.py:57 #: terminal/models/component/storage.py:146 terminal/serializers/applet.py:29 #: terminal/serializers/session.py:22 terminal/serializers/storage.py:224 @@ -589,60 +589,60 @@ msgstr "カテゴリ" msgid "Type" msgstr "タイプ" -#: accounts/serializers/account/account.py:169 +#: accounts/serializers/account/account.py:195 msgid "Asset not found" msgstr "資産が存在しません" -#: accounts/serializers/account/account.py:175 +#: accounts/serializers/account/account.py:201 #: accounts/serializers/account/base.py:64 msgid "Has secret" msgstr "エスクローされたパスワード" -#: accounts/serializers/account/account.py:207 ops/models/celery.py:60 +#: accounts/serializers/account/account.py:233 ops/models/celery.py:60 #: tickets/models/comment.py:13 tickets/models/ticket/general.py:45 #: tickets/models/ticket/general.py:279 tickets/serializers/super_ticket.py:14 #: tickets/serializers/ticket/ticket.py:21 msgid "State" msgstr "状態" -#: accounts/serializers/account/account.py:209 +#: accounts/serializers/account/account.py:235 #, fuzzy #| msgid "Change by" msgid "Changed" msgstr "による変更" -#: accounts/serializers/account/account.py:213 +#: accounts/serializers/account/account.py:241 #: accounts/serializers/automations/base.py:22 #: assets/models/automations/base.py:19 #: assets/serializers/automations/base.py:20 ops/models/base.py:17 -#: ops/models/job.py:104 ops/serializers/job.py:20 +#: ops/models/job.py:105 ops/serializers/job.py:21 #: terminal/templates/terminal/_msg_command_execute_alert.html:16 msgid "Assets" msgstr "資産" -#: accounts/serializers/account/account.py:284 +#: accounts/serializers/account/account.py:293 #, fuzzy #| msgid "Name already exists" msgid "Account already exists" msgstr "名前は既に存在します。" -#: accounts/serializers/account/account.py:320 +#: accounts/serializers/account/account.py:330 #, fuzzy, python-format #| msgid "Current user not support mfa type: {}" msgid "Asset does not support this secret type: %s" msgstr "現在のユーザーはmfaタイプをサポートしていません: {}" -#: accounts/serializers/account/account.py:351 +#: accounts/serializers/account/account.py:361 #, fuzzy #| msgid "Account name" msgid "Account has exist" msgstr "アカウント名" -#: accounts/serializers/account/account.py:393 acls/models/base.py:98 +#: accounts/serializers/account/account.py:401 acls/models/base.py:98 #: acls/models/login_acl.py:13 acls/serializers/base.py:55 #: acls/serializers/login_acl.py:21 assets/models/cmd_filter.py:24 #: assets/models/label.py:16 audits/models.py:44 audits/models.py:63 -#: audits/models.py:141 authentication/models/connection_token.py:29 +#: audits/models.py:141 authentication/models/connection_token.py:30 #: authentication/models/sso_token.py:16 #: notifications/models/notification.py:12 #: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58 @@ -656,7 +656,7 @@ msgstr "アカウント名" msgid "User" msgstr "ユーザー" -#: accounts/serializers/account/account.py:394 +#: accounts/serializers/account/account.py:402 #: authentication/templates/authentication/_access_key_modal.html:33 #: terminal/notifications.py:98 terminal/notifications.py:146 msgid "Date" @@ -688,12 +688,12 @@ msgid "Key password" msgstr "キーパスワード" #: accounts/serializers/account/base.py:80 -#: assets/serializers/asset/common.py:298 +#: assets/serializers/asset/common.py:304 msgid "Spec info" msgstr "特別情報" #: accounts/serializers/automations/base.py:23 -#: assets/models/asset/common.py:108 assets/models/automations/base.py:18 +#: assets/models/asset/common.py:129 assets/models/automations/base.py:18 #: assets/models/cmd_filter.py:32 assets/serializers/automations/base.py:21 #: perms/models/asset_permission.py:67 msgid "Nodes" @@ -704,7 +704,7 @@ msgid "Name already exists" msgstr "名前は既に存在します。" #: accounts/serializers/automations/base.py:53 -#: assets/models/automations/base.py:117 +#: assets/models/automations/base.py:118 #: assets/serializers/automations/base.py:39 msgid "Automation snapshot" msgstr "自動スナップショット" @@ -713,20 +713,20 @@ msgstr "自動スナップショット" msgid "SSH Key strategy" msgstr "SSHキー戦略" -#: accounts/serializers/automations/change_secret.py:80 +#: accounts/serializers/automations/change_secret.py:81 msgid "* Please enter the correct password length" msgstr "* 正しいパスワードの長さを入力してください" -#: accounts/serializers/automations/change_secret.py:84 +#: accounts/serializers/automations/change_secret.py:85 msgid "* Password length range 6-30 bits" msgstr "* パスワードの長さの範囲6-30ビット" -#: accounts/serializers/automations/change_secret.py:114 -#: assets/models/automations/base.py:126 +#: accounts/serializers/automations/change_secret.py:115 +#: assets/models/automations/base.py:127 msgid "Automation task execution" msgstr "自動タスク実行履歴" -#: accounts/serializers/automations/change_secret.py:154 audits/const.py:52 +#: accounts/serializers/automations/change_secret.py:155 audits/const.py:52 #: audits/models.py:54 audits/signal_handlers/activity_log.py:33 #: common/const/choices.py:18 ops/const.py:56 ops/serializers/celery.py:39 #: terminal/const.py:59 terminal/models/session/sharing.py:107 @@ -803,12 +803,12 @@ msgstr "1-100、低い値は最初に一致します" #: acls/models/base.py:82 acls/serializers/base.py:75 #: acls/serializers/login_acl.py:23 assets/models/cmd_filter.py:86 -#: authentication/serializers/connect_token_secret.py:79 +#: authentication/serializers/connect_token_secret.py:80 msgid "Reviewers" msgstr "レビュー担当者" #: acls/models/base.py:83 authentication/models/access_key.py:17 -#: authentication/models/connection_token.py:48 +#: authentication/models/connection_token.py:49 #: authentication/templates/authentication/_access_key_modal.html:32 #: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:27 #: tickets/const.py:37 @@ -816,7 +816,7 @@ msgid "Active" msgstr "アクティブ" #: acls/models/command_acl.py:16 assets/models/cmd_filter.py:60 -#: ops/serializers/job.py:65 terminal/const.py:67 +#: ops/serializers/job.py:71 terminal/const.py:67 #: terminal/models/session/session.py:43 terminal/serializers/command.py:18 #: terminal/templates/terminal/_msg_command_alert.html:12 #: terminal/templates/terminal/_msg_command_execute_alert.html:10 @@ -828,7 +828,7 @@ msgid "Regex" msgstr "正規情報" #: acls/models/command_acl.py:26 assets/models/cmd_filter.py:79 -#: settings/serializers/basic.py:10 xpack/plugins/license/models.py:29 +#: settings/serializers/basic.py:10 xpack/plugins/license/models.py:30 msgid "Content" msgstr "コンテンツ" @@ -842,7 +842,7 @@ msgstr "家を無視する" #: acls/models/command_acl.py:33 acls/models/command_acl.py:96 #: acls/serializers/command_acl.py:28 -#: authentication/serializers/connect_token_secret.py:76 +#: authentication/serializers/connect_token_secret.py:77 msgid "Command group" msgstr "コマンドグループ" @@ -892,7 +892,7 @@ msgstr "" "192.168.10.1、192.168.1.0/24、10.1.1.1-10.1.1.20、2001:db8:2de::e13、2001:" "db8:1a:1110:::/64 (ドメイン名サポート)" -#: acls/serializers/base.py:40 assets/serializers/asset/host.py:35 +#: acls/serializers/base.py:40 assets/serializers/asset/host.py:19 msgid "IP/Host" msgstr "IP/ホスト" @@ -972,7 +972,7 @@ msgstr "アプリケーション" msgid "Can match application" msgstr "アプリケーションを一致させることができます" -#: assets/api/asset/asset.py:147 +#: assets/api/asset/asset.py:141 msgid "Cannot create asset directly, you should create a host or other" msgstr "" "資産を直接作成することはできません。ホストまたはその他を作成する必要がありま" @@ -998,12 +998,12 @@ msgstr "削除に失敗し、ノードにアセットが含まれています。 msgid "App assets" msgstr "アプリ資産" -#: assets/automations/base/manager.py:113 +#: assets/automations/base/manager.py:136 msgid "{} disabled" msgstr "{} 無効" #: assets/automations/ping_gateway/manager.py:33 -#: authentication/models/connection_token.py:114 +#: authentication/models/connection_token.py:115 msgid "No account" msgstr "アカウントなし" @@ -1060,7 +1060,7 @@ msgid "Device" msgstr "インターネット機器" #: assets/const/category.py:12 assets/models/asset/database.py:9 -#: assets/models/asset/database.py:24 assets/serializers/asset/common.py:91 +#: assets/models/asset/database.py:24 msgid "Database" msgstr "データベース" @@ -1069,7 +1069,7 @@ msgid "Cloud service" msgstr "クラウド サービス" #: assets/const/category.py:14 assets/models/asset/web.py:16 audits/const.py:33 -#: terminal/models/applet/applet.py:25 +#: terminal/models/applet/applet.py:24 msgid "Web" msgstr "Web" @@ -1091,7 +1091,7 @@ msgstr "私有雲" msgid "Kubernetes" msgstr "" -#: assets/const/device.py:7 terminal/models/applet/applet.py:24 +#: assets/const/device.py:7 terminal/models/applet/applet.py:23 #: tickets/const.py:8 msgid "General" msgstr "一般" @@ -1112,7 +1112,7 @@ msgstr "ファイアウォール" msgid "Other" msgstr "その他" -#: assets/const/types.py:214 +#: assets/const/types.py:215 msgid "All types" msgstr "いろんなタイプ" @@ -1130,7 +1130,7 @@ msgid "Basic" msgstr "基本" #: assets/const/web.py:61 assets/models/asset/web.py:13 -#: assets/serializers/asset/common.py:99 assets/serializers/platform.py:40 +#: assets/serializers/platform.py:40 msgid "Script" msgstr "脚本" @@ -1148,9 +1148,9 @@ msgstr "SSHパブリックキー" #: assets/models/_user.py:27 assets/models/cmd_filter.py:40 #: assets/models/cmd_filter.py:88 assets/models/group.py:23 -#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:110 +#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:111 #: ops/models/playbook.py:26 rbac/models/role.py:37 settings/models.py:38 -#: terminal/models/applet/applet.py:36 terminal/models/applet/applet.py:160 +#: terminal/models/applet/applet.py:35 terminal/models/applet/applet.py:183 #: terminal/models/applet/host.py:111 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 @@ -1159,9 +1159,9 @@ msgstr "SSHパブリックキー" msgid "Comment" msgstr "コメント" -#: assets/models/_user.py:28 assets/models/automations/base.py:113 +#: assets/models/_user.py:28 assets/models/automations/base.py:114 #: assets/models/cmd_filter.py:41 assets/models/group.py:22 -#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:190 +#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:191 #: users/models/user.py:943 msgid "Date created" msgstr "作成された日付" @@ -1198,9 +1198,9 @@ msgstr "管理ユーザー" msgid "Username same with user" msgstr "ユーザーと同じユーザー名" -#: assets/models/_user.py:52 authentication/models/connection_token.py:38 -#: authentication/serializers/connect_token_secret.py:102 -#: terminal/models/applet/applet.py:34 terminal/serializers/session.py:20 +#: assets/models/_user.py:52 authentication/models/connection_token.py:39 +#: authentication/serializers/connect_token_secret.py:103 +#: terminal/models/applet/applet.py:33 terminal/serializers/session.py:20 #: terminal/serializers/session.py:41 terminal/serializers/storage.py:68 msgid "Protocol" msgstr "プロトコル" @@ -1259,53 +1259,54 @@ msgstr "クラウド サービス" msgid "Port" msgstr "ポート" -#: assets/models/asset/common.py:103 assets/serializers/asset/common.py:129 +#: assets/models/asset/common.py:124 assets/serializers/asset/common.py:145 msgid "Address" msgstr "アドレス" -#: assets/models/asset/common.py:104 assets/models/platform.py:100 -#: authentication/serializers/connect_token_secret.py:106 +#: assets/models/asset/common.py:125 assets/models/platform.py:120 +#: authentication/serializers/connect_token_secret.py:107 #: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:187 +#: xpack/plugins/cloud/serializers/account_attrs.py:197 msgid "Platform" msgstr "プラットフォーム" -#: assets/models/asset/common.py:106 assets/models/domain.py:21 -#: authentication/serializers/connect_token_secret.py:124 +#: assets/models/asset/common.py:127 assets/models/domain.py:21 +#: authentication/serializers/connect_token_secret.py:125 #: perms/serializers/user_permission.py:28 msgid "Domain" msgstr "ドメイン" -#: assets/models/asset/common.py:110 +#: assets/models/asset/common.py:131 msgid "Labels" msgstr "ラベル" -#: assets/models/asset/common.py:111 +#: assets/models/asset/common.py:132 assets/serializers/asset/common.py:305 +#: assets/serializers/asset/host.py:11 #, fuzzy #| msgid "Gather asset hardware info" msgid "Gathered info" msgstr "資産ハードウェア情報の収集" -#: assets/models/asset/common.py:112 assets/serializers/asset/common.py:109 -#: assets/serializers/asset/common.py:179 +#: assets/models/asset/common.py:133 assets/serializers/asset/custom.py:14 +#: assets/serializers/asset/custom.py:22 #, fuzzy #| msgid "Auto info" msgid "Custom info" msgstr "自動情報" -#: assets/models/asset/common.py:271 +#: assets/models/asset/common.py:309 msgid "Can refresh asset hardware info" msgstr "資産ハードウェア情報を更新できます" -#: assets/models/asset/common.py:272 +#: assets/models/asset/common.py:310 msgid "Can test asset connectivity" msgstr "資産接続をテストできます" -#: assets/models/asset/common.py:273 +#: assets/models/asset/common.py:311 msgid "Can match asset" msgstr "アセットを一致させることができます" -#: assets/models/asset/common.py:274 +#: assets/models/asset/common.py:312 msgid "Can change asset nodes" msgstr "資産ノードを変更できます" @@ -1315,7 +1316,7 @@ msgstr "資産ノードを変更できます" msgid "Custom asset" msgstr "カスタムユーザー" -#: assets/models/asset/database.py:10 assets/serializers/asset/common.py:92 +#: assets/models/asset/database.py:10 assets/serializers/platform.py:45 #: settings/serializers/email.py:37 msgid "Use SSL" msgstr "SSLの使用" @@ -1332,7 +1333,7 @@ msgstr "クライアント証明書" msgid "Client key" msgstr "クライアントキー" -#: assets/models/asset/database.py:14 assets/serializers/asset/common.py:93 +#: assets/models/asset/database.py:14 msgid "Allow invalid cert" msgstr "証明書チェックを無視" @@ -1340,37 +1341,38 @@ msgstr "証明書チェックを無視" msgid "Autofill" msgstr "自動充填" -#: assets/models/asset/web.py:10 assets/serializers/asset/common.py:96 -#: assets/serializers/platform.py:32 +#: assets/models/asset/web.py:10 assets/serializers/platform.py:32 msgid "Username selector" msgstr "ユーザー名ピッカー" -#: assets/models/asset/web.py:11 assets/serializers/asset/common.py:97 -#: assets/serializers/platform.py:35 +#: assets/models/asset/web.py:11 assets/serializers/platform.py:35 msgid "Password selector" msgstr "パスワードセレクター" -#: assets/models/asset/web.py:12 assets/serializers/asset/common.py:98 -#: assets/serializers/platform.py:38 +#: assets/models/asset/web.py:12 assets/serializers/platform.py:38 msgid "Submit selector" msgstr "ボタンセレクターを確認する" #: assets/models/automations/base.py:17 assets/models/cmd_filter.py:38 -#: assets/serializers/asset/common.py:297 rbac/tree.py:35 +#: assets/serializers/asset/common.py:303 rbac/tree.py:35 msgid "Accounts" msgstr "アカウント" -#: assets/models/automations/base.py:28 assets/models/automations/base.py:110 +#: assets/models/automations/base.py:22 ops/models/job.py:187 +msgid "Parameters" +msgstr "パラメータ" + +#: assets/models/automations/base.py:29 assets/models/automations/base.py:111 msgid "Automation task" msgstr "自動化されたタスク" -#: assets/models/automations/base.py:103 +#: assets/models/automations/base.py:104 msgid "Asset automation task" msgstr "アセットの自動化タスク" -#: assets/models/automations/base.py:112 audits/models.py:177 -#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:183 -#: terminal/models/applet/applet.py:159 terminal/models/applet/host.py:108 +#: assets/models/automations/base.py:113 audits/models.py:177 +#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:184 +#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:108 #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:103 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 @@ -1438,7 +1440,7 @@ msgid "Asset group" msgstr "資産グループ" #: assets/models/group.py:34 assets/models/platform.py:17 -#: assets/serializers/platform.py:97 +#: assets/serializers/platform.py:102 #: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "デフォルト" @@ -1453,17 +1455,17 @@ msgstr "システム" #: assets/models/label.py:19 assets/models/node.py:544 #: assets/serializers/cagegory.py:7 assets/serializers/cagegory.py:14 -#: authentication/models/connection_token.py:26 -#: authentication/serializers/connect_token_secret.py:113 -#: common/serializers/common.py:80 settings/models.py:34 +#: authentication/models/connection_token.py:27 +#: authentication/serializers/connect_token_secret.py:114 +#: common/serializers/common.py:86 settings/models.py:34 msgid "Value" msgstr "値" -#: assets/models/label.py:40 assets/serializers/asset/common.py:105 +#: assets/models/label.py:40 assets/serializers/asset/common.py:122 #: assets/serializers/cagegory.py:6 assets/serializers/cagegory.py:13 -#: assets/serializers/platform.py:94 -#: authentication/serializers/connect_token_secret.py:112 -#: common/serializers/common.py:79 settings/serializers/sms.py:7 +#: assets/serializers/platform.py:100 +#: authentication/serializers/connect_token_secret.py:113 +#: common/serializers/common.py:85 settings/serializers/sms.py:7 msgid "Label" msgstr "ラベル" @@ -1515,90 +1517,104 @@ msgstr "パブリックIP" msgid "Setting" msgstr "設定" -#: assets/models/platform.py:31 audits/const.py:47 settings/models.py:37 +#: assets/models/platform.py:39 audits/const.py:47 settings/models.py:37 #: terminal/serializers/applet_host.py:29 msgid "Enabled" msgstr "有効化" -#: assets/models/platform.py:32 +#: assets/models/platform.py:40 msgid "Ansible config" msgstr "Ansible 構成" -#: assets/models/platform.py:33 assets/serializers/platform.py:60 +#: assets/models/platform.py:42 assets/serializers/platform.py:63 msgid "Ping enabled" msgstr "アセット ディスカバリを有効にする" -#: assets/models/platform.py:34 assets/serializers/platform.py:61 +#: assets/models/platform.py:43 assets/serializers/platform.py:64 msgid "Ping method" msgstr "資産検出方法" -#: assets/models/platform.py:35 assets/models/platform.py:48 -#: assets/serializers/platform.py:62 +#: assets/models/platform.py:44 +msgid "Ping params" +msgstr "資産検出パラメータ" + +#: assets/models/platform.py:46 assets/models/platform.py:70 +#: assets/serializers/platform.py:65 msgid "Gather facts enabled" msgstr "資産情報の収集を有効にする" -#: assets/models/platform.py:36 assets/models/platform.py:50 -#: assets/serializers/platform.py:63 +#: assets/models/platform.py:48 assets/models/platform.py:72 +#: assets/serializers/platform.py:66 msgid "Gather facts method" msgstr "情報収集の方法" -#: assets/models/platform.py:37 assets/serializers/platform.py:66 +#: assets/models/platform.py:50 assets/models/platform.py:74 +msgid "Gather facts params" +msgstr "情報収集パラメータ" + +#: assets/models/platform.py:52 assets/serializers/platform.py:69 msgid "Change secret enabled" msgstr "パスワードの変更が有効" -#: assets/models/platform.py:39 assets/serializers/platform.py:67 +#: assets/models/platform.py:54 assets/serializers/platform.py:70 msgid "Change secret method" msgstr "パスワード変更モード" -#: assets/models/platform.py:41 assets/serializers/platform.py:68 +#: assets/models/platform.py:56 +msgid "Change secret params" +msgstr "パスワード変更パラメータ" + +#: assets/models/platform.py:58 assets/serializers/platform.py:71 msgid "Push account enabled" msgstr "アカウントのプッシュを有効にする" -#: assets/models/platform.py:43 assets/serializers/platform.py:69 +#: assets/models/platform.py:60 assets/serializers/platform.py:72 msgid "Push account method" msgstr "アカウントプッシュ方式" -#: assets/models/platform.py:45 assets/serializers/platform.py:64 +#: assets/models/platform.py:62 +msgid "Push account params" +msgstr "アカウントプッシュパラメータ" + +#: assets/models/platform.py:64 assets/serializers/platform.py:67 msgid "Verify account enabled" msgstr "アカウントの確認をオンにする" -#: assets/models/platform.py:47 assets/serializers/platform.py:65 +#: assets/models/platform.py:66 assets/serializers/platform.py:68 msgid "Verify account method" msgstr "アカウント認証方法" -#: assets/models/platform.py:68 tickets/models/ticket/general.py:300 +#: assets/models/platform.py:68 +msgid "Verify account params" +msgstr "アカウント認証パラメータ" + +#: assets/models/platform.py:92 tickets/models/ticket/general.py:300 msgid "Meta" msgstr "メタ" -#: assets/models/platform.py:69 +#: assets/models/platform.py:93 msgid "Internal" msgstr "ビルトイン" -#: assets/models/platform.py:73 assets/serializers/platform.py:109 +#: assets/models/platform.py:97 assets/serializers/platform.py:115 msgid "Charset" msgstr "シャーセット" -#: assets/models/platform.py:75 assets/serializers/platform.py:133 +#: assets/models/platform.py:99 assets/serializers/platform.py:142 msgid "Domain enabled" msgstr "ドメインを有効にする" -#: assets/models/platform.py:77 assets/serializers/platform.py:132 +#: assets/models/platform.py:101 assets/serializers/platform.py:141 msgid "Su enabled" msgstr "アカウントの切り替えを有効にする" -#: assets/models/platform.py:78 assets/serializers/platform.py:115 +#: assets/models/platform.py:102 assets/serializers/platform.py:121 msgid "Su method" msgstr "アカウントの切り替え方法" -#: assets/models/platform.py:81 assets/serializers/platform.py:113 -msgid "Automation" -msgstr "オートメーション" - -#: assets/models/platform.py:83 assets/serializers/platform.py:118 -#, fuzzy -#| msgid "Custom user" +#: assets/models/platform.py:103 assets/serializers/platform.py:124 msgid "Custom fields" -msgstr "カスタムユーザー" +msgstr "カスタムフィールド" #: assets/models/utils.py:18 #, python-format @@ -1613,40 +1629,36 @@ msgstr "" "プラットフォームタイプがスキップされた資産に合致しない、資産内の一括更新プ" "ラットフォーム" -#: assets/serializers/asset/common.py:95 -msgid "Auto fill" -msgstr "自動充填" - -#: assets/serializers/asset/common.py:106 assets/serializers/platform.py:112 +#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:118 #: authentication/serializers/connect_token_secret.py:29 -#: authentication/serializers/connect_token_secret.py:63 +#: authentication/serializers/connect_token_secret.py:64 #: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99 msgid "Protocols" msgstr "プロトコル" -#: assets/serializers/asset/common.py:108 -#: assets/serializers/asset/common.py:130 +#: assets/serializers/asset/common.py:125 +#: assets/serializers/asset/common.py:146 msgid "Node path" msgstr "ノードパスです" -#: assets/serializers/asset/common.py:127 -#: assets/serializers/asset/common.py:299 +#: assets/serializers/asset/common.py:143 +#: assets/serializers/asset/common.py:306 msgid "Auto info" msgstr "自動情報" -#: assets/serializers/asset/common.py:220 +#: assets/serializers/asset/common.py:225 msgid "Platform not exist" msgstr "プラットフォームが存在しません" -#: assets/serializers/asset/common.py:255 +#: assets/serializers/asset/common.py:261 msgid "port out of range (1-65535)" msgstr "ポート番号が範囲外です (1-65535)" -#: assets/serializers/asset/common.py:262 +#: assets/serializers/asset/common.py:268 msgid "Protocol is required: {}" msgstr "プロトコルが必要です: {}" -#: assets/serializers/asset/database.py:25 common/serializers/fields.py:100 +#: assets/serializers/asset/database.py:25 common/serializers/fields.py:102 #: tickets/serializers/ticket/common.py:58 #: xpack/plugins/cloud/serializers/account_attrs.py:56 #: xpack/plugins/cloud/serializers/account_attrs.py:79 @@ -1654,59 +1666,56 @@ msgstr "プロトコルが必要です: {}" msgid "This field is required." msgstr "このフィールドは必須です。" -#: assets/serializers/asset/host.py:11 +#: assets/serializers/asset/info/gathered.py:6 msgid "Vendor" msgstr "ベンダー" -#: assets/serializers/asset/host.py:12 +#: assets/serializers/asset/info/gathered.py:7 msgid "Model" msgstr "モデル" -#: assets/serializers/asset/host.py:13 tickets/models/ticket/general.py:299 +#: assets/serializers/asset/info/gathered.py:8 +#: tickets/models/ticket/general.py:299 msgid "Serial number" msgstr "シリアル番号" -#: assets/serializers/asset/host.py:14 +#: assets/serializers/asset/info/gathered.py:9 msgid "CPU model" msgstr "CPU モデル" -#: assets/serializers/asset/host.py:15 +#: assets/serializers/asset/info/gathered.py:10 msgid "CPU count" msgstr "CPU カウント" -#: assets/serializers/asset/host.py:16 +#: assets/serializers/asset/info/gathered.py:11 msgid "CPU cores" msgstr "CPU カラー" -#: assets/serializers/asset/host.py:17 +#: assets/serializers/asset/info/gathered.py:12 msgid "CPU vcpus" msgstr "CPU 合計" -#: assets/serializers/asset/host.py:18 +#: assets/serializers/asset/info/gathered.py:13 msgid "Memory" msgstr "メモリ" -#: assets/serializers/asset/host.py:19 +#: assets/serializers/asset/info/gathered.py:14 msgid "Disk total" msgstr "ディスクの合計" -#: assets/serializers/asset/host.py:21 -#: authentication/serializers/connect_token_secret.py:103 +#: assets/serializers/asset/info/gathered.py:16 +#: authentication/serializers/connect_token_secret.py:104 msgid "OS" msgstr "OS" -#: assets/serializers/asset/host.py:22 +#: assets/serializers/asset/info/gathered.py:17 msgid "OS version" msgstr "システムバージョン" -#: assets/serializers/asset/host.py:23 +#: assets/serializers/asset/info/gathered.py:18 msgid "OS arch" msgstr "システムアーキテクチャ" -#: assets/serializers/asset/host.py:27 -msgid "Info" -msgstr "情報" - #: assets/serializers/cagegory.py:9 msgid "Constraints" msgstr "制約" @@ -1715,7 +1724,7 @@ msgstr "制約" msgid "Types" msgstr "タイプ" -#: assets/serializers/gateway.py:23 common/validators.py:32 +#: assets/serializers/gateway.py:23 common/validators.py:35 msgid "This field must be unique." msgstr "このフィールドは一意である必要があります。" @@ -1747,25 +1756,39 @@ msgstr "SFTP ルート パス" msgid "Auth with username" msgstr "ユーザー名で認証する" -#: assets/serializers/platform.py:70 +#: assets/serializers/platform.py:73 msgid "Gather accounts enabled" msgstr "アカウント収集を有効にする" -#: assets/serializers/platform.py:71 +#: assets/serializers/platform.py:74 msgid "Gather accounts method" msgstr "アカウントの収集方法" -#: assets/serializers/platform.py:134 +#: assets/serializers/platform.py:103 +#, fuzzy +#| msgid "Help" +msgid "Help text" +msgstr "ヘルプ" + +#: assets/serializers/platform.py:104 +msgid "Choices" +msgstr "" + +#: assets/serializers/platform.py:119 +msgid "Automation" +msgstr "オートメーション" + +#: assets/serializers/platform.py:143 msgid "Default Domain" msgstr "デフォルト ドメイン" -#: assets/serializers/platform.py:143 +#: assets/serializers/platform.py:152 #, fuzzy #| msgid "test_phone is required" msgid "type is required" msgstr "携帯番号をテストこのフィールドは必須です" -#: assets/serializers/platform.py:173 +#: assets/serializers/platform.py:189 #, fuzzy #| msgid "Protocol is required: {}" msgid "Protocols is required" @@ -1906,7 +1929,7 @@ msgid "Change password" msgstr "パスワードを変更する" #: audits/const.py:34 settings/serializers/terminal.py:6 -#: terminal/models/applet/host.py:25 terminal/models/component/terminal.py:163 +#: terminal/models/applet/host.py:25 terminal/models/component/terminal.py:162 #: terminal/serializers/session.py:48 msgid "Terminal" msgstr "ターミナル" @@ -2020,7 +2043,7 @@ msgstr "ユーザーエージェント" #: audits/models.py:169 audits/serializers.py:47 #: authentication/templates/authentication/_mfa_confirm_modal.html:14 #: users/forms/profile.py:65 users/models/user.py:740 -#: users/serializers/profile.py:124 +#: users/serializers/profile.py:126 msgid "MFA" msgstr "MFA" @@ -2105,19 +2128,19 @@ msgstr "監査セッション タスク ログのクリーンアップ" msgid "This action require verify your MFA" msgstr "この操作には、MFAを検証する必要があります" -#: authentication/api/connection_token.py:295 +#: authentication/api/connection_token.py:296 msgid "Account not found" msgstr "アカウントが見つかりません" -#: authentication/api/connection_token.py:298 +#: authentication/api/connection_token.py:299 msgid "Permission expired" msgstr "承認の有効期限が切れています" -#: authentication/api/connection_token.py:310 +#: authentication/api/connection_token.py:311 msgid "ACL action is reject" msgstr "ACL アクションは拒否です" -#: authentication/api/connection_token.py:314 +#: authentication/api/connection_token.py:315 msgid "ACL action is review" msgstr "ACL アクションはレビューです" @@ -2490,70 +2513,70 @@ msgstr "MFAタイプ ({}) が有効になっていない" msgid "Please change your password" msgstr "パスワードを変更してください" -#: authentication/models/connection_token.py:35 +#: authentication/models/connection_token.py:36 #: terminal/serializers/storage.py:111 msgid "Account name" msgstr "アカウント名" -#: authentication/models/connection_token.py:36 +#: authentication/models/connection_token.py:37 msgid "Input username" msgstr "カスタム ユーザー名" -#: authentication/models/connection_token.py:37 +#: authentication/models/connection_token.py:38 #: authentication/serializers/connection_token.py:17 msgid "Input secret" msgstr "カスタムパスワード" -#: authentication/models/connection_token.py:39 +#: authentication/models/connection_token.py:40 msgid "Connect method" msgstr "接続方法" -#: authentication/models/connection_token.py:40 +#: authentication/models/connection_token.py:41 #: rbac/serializers/rolebinding.py:21 msgid "User display" msgstr "ユーザー表示" -#: authentication/models/connection_token.py:41 +#: authentication/models/connection_token.py:42 msgid "Asset display" msgstr "アセット名" -#: authentication/models/connection_token.py:42 +#: authentication/models/connection_token.py:43 #: authentication/models/temp_token.py:13 perms/models/asset_permission.py:74 #: tickets/models/ticket/apply_application.py:31 #: tickets/models/ticket/apply_asset.py:20 users/models/user.py:761 msgid "Date expired" msgstr "期限切れの日付" -#: authentication/models/connection_token.py:46 +#: authentication/models/connection_token.py:47 #: perms/models/asset_permission.py:77 msgid "From ticket" msgstr "チケットから" -#: authentication/models/connection_token.py:52 +#: authentication/models/connection_token.py:53 msgid "Connection token" msgstr "接続トークン" -#: authentication/models/connection_token.py:54 +#: authentication/models/connection_token.py:55 msgid "Can view connection token secret" msgstr "接続トークンの秘密を表示できます" -#: authentication/models/connection_token.py:101 +#: authentication/models/connection_token.py:102 msgid "Connection token inactive" msgstr "接続トークンがアクティブ化されていません" -#: authentication/models/connection_token.py:104 +#: authentication/models/connection_token.py:105 msgid "Connection token expired at: {}" msgstr "接続トークンの有効期限: {}" -#: authentication/models/connection_token.py:107 +#: authentication/models/connection_token.py:108 msgid "No user or invalid user" msgstr "ユーザーなしまたは期限切れのユーザー" -#: authentication/models/connection_token.py:111 +#: authentication/models/connection_token.py:112 msgid "No asset or inactive asset" msgstr "アセットがないか、有効化されていないアセット" -#: authentication/models/connection_token.py:258 +#: authentication/models/connection_token.py:261 msgid "Super connection token" msgstr "スーパー接続トークン" @@ -2581,23 +2604,23 @@ msgstr "異なる都市ログインのリマインダー" msgid "binding reminder" msgstr "バインディングリマインダー" -#: authentication/serializers/connect_token_secret.py:104 +#: authentication/serializers/connect_token_secret.py:105 msgid "Is builtin" msgstr "ビルトイン" -#: authentication/serializers/connect_token_secret.py:108 +#: authentication/serializers/connect_token_secret.py:109 msgid "Options" msgstr "オプション" -#: authentication/serializers/connect_token_secret.py:115 +#: authentication/serializers/connect_token_secret.py:116 msgid "Component" msgstr "コンポーネント" -#: authentication/serializers/connect_token_secret.py:126 +#: authentication/serializers/connect_token_secret.py:127 msgid "Expired now" msgstr "すぐに期限切れ" -#: authentication/serializers/connect_token_secret.py:145 +#: authentication/serializers/connect_token_secret.py:146 #: authentication/templates/authentication/_access_key_modal.html:30 #: perms/models/perm_node.py:21 users/serializers/group.py:33 msgid "ID" @@ -2621,7 +2644,7 @@ msgstr "アクション" #: authentication/serializers/connection_token.py:41 #: perms/serializers/permission.py:38 perms/serializers/permission.py:70 -#: users/serializers/user.py:93 users/serializers/user.py:165 +#: users/serializers/user.py:97 users/serializers/user.py:172 msgid "Is expired" msgstr "期限切れです" @@ -2641,8 +2664,8 @@ msgid "The {} cannot be empty" msgstr "{} 空にしてはならない" #: authentication/serializers/token.py:79 perms/serializers/permission.py:37 -#: perms/serializers/permission.py:71 users/serializers/user.py:94 -#: users/serializers/user.py:163 +#: perms/serializers/permission.py:71 users/serializers/user.py:98 +#: users/serializers/user.py:170 msgid "Is valid" msgstr "有効です" @@ -2668,13 +2691,13 @@ msgstr "表示" #: authentication/templates/authentication/_access_key_modal.html:66 #: settings/serializers/security.py:39 users/models/user.py:601 -#: users/serializers/profile.py:115 +#: users/serializers/profile.py:116 #: users/templates/users/user_verify_mfa.html:36 msgid "Disable" msgstr "無効化" #: authentication/templates/authentication/_access_key_modal.html:67 -#: users/models/user.py:602 users/serializers/profile.py:116 +#: users/models/user.py:602 users/serializers/profile.py:117 #: users/templates/users/mfa_setting.html:26 #: users/templates/users/mfa_setting.html:68 msgid "Enable" @@ -3034,12 +3057,12 @@ msgstr "" msgid "Canceled" msgstr "キャンセル" -#: common/const/common.py:3 +#: common/const/common.py:5 #, python-format msgid "%(name)s was created successfully" msgstr "%(name)s が正常に作成されました" -#: common/const/common.py:4 +#: common/const/common.py:6 #, python-format msgid "%(name)s was updated successfully" msgstr "%(name)s は正常に更新されました" @@ -3207,29 +3230,29 @@ msgstr "確認コードが正しくありません" msgid "Please wait {} seconds before sending" msgstr "{} 秒待ってから送信してください" -#: common/serializers/common.py:84 +#: common/serializers/common.py:90 msgid "Children" msgstr "" -#: common/serializers/common.py:92 +#: common/serializers/common.py:98 msgid "File" msgstr "書類" -#: common/serializers/fields.py:101 +#: common/serializers/fields.py:103 #, python-brace-format msgid "Invalid pk \"{pk_value}\" - object does not exist." msgstr "無効な pk \"{pk_value}\" - オブジェクトが存在しません" -#: common/serializers/fields.py:102 +#: common/serializers/fields.py:104 #, python-brace-format msgid "Incorrect type. Expected pk value, received {data_type}." msgstr "エラータイプ。 予想される pk 値、受信 {data_type}。" -#: common/serializers/fields.py:172 +#: common/serializers/fields.py:174 msgid "Invalid data type, should be list" msgstr "間違ったデータ タイプです。リストにする必要があります" -#: common/serializers/fields.py:187 +#: common/serializers/fields.py:189 msgid "Invalid choice: {}" msgstr "無効なオプション: {}" @@ -3254,15 +3277,15 @@ msgstr "無効なアドレス。" msgid "Hello %s" msgstr "こんにちは %s" -#: common/validators.py:14 +#: common/validators.py:17 msgid "Special char not allowed" msgstr "特別なcharは許可されていません" -#: common/validators.py:40 +#: common/validators.py:43 msgid "Should not contains special characters" msgstr "特殊文字を含むべきではない" -#: common/validators.py:46 +#: common/validators.py:48 msgid "The mobile phone number format is incorrect" msgstr "携帯電話番号の形式が正しくありません" @@ -3360,11 +3383,11 @@ msgstr "投稿サイトニュース" msgid "No account available" msgstr "利用可能なアカウントがありません" -#: ops/ansible/inventory.py:209 +#: ops/ansible/inventory.py:236 msgid "Ansible disabled" msgstr "Ansible 無効" -#: ops/ansible/inventory.py:225 +#: ops/ansible/inventory.py:252 msgid "Skip hosts below:" msgstr "次のホストをスキップします: " @@ -3388,7 +3411,7 @@ msgstr "現在プレイブックは1つのジョブで使用されています" msgid "Unsupported file content" msgstr "サポートされていないファイルの内容" -#: ops/apps.py:9 ops/notifications.py:16 rbac/tree.py:55 +#: ops/apps.py:9 ops/notifications.py:17 rbac/tree.py:55 msgid "App ops" msgstr "アプリ操作" @@ -3428,7 +3451,7 @@ msgstr "VCS" msgid "Adhoc" msgstr "コマンド#コマンド#" -#: ops/const.py:39 ops/models/job.py:100 +#: ops/const.py:39 ops/models/job.py:101 msgid "Playbook" msgstr "Playbook" @@ -3485,17 +3508,17 @@ msgstr "定期的または定期的に設定を行う必要があります" msgid "Pattern" msgstr "パターン" -#: ops/models/adhoc.py:24 ops/models/job.py:95 +#: ops/models/adhoc.py:24 ops/models/job.py:96 msgid "Module" msgstr "モジュール" -#: ops/models/adhoc.py:25 ops/models/celery.py:58 ops/models/job.py:94 +#: ops/models/adhoc.py:25 ops/models/celery.py:58 ops/models/job.py:95 #: terminal/models/component/task.py:16 msgid "Args" msgstr "アルグ" #: ops/models/adhoc.py:26 ops/models/base.py:16 ops/models/base.py:53 -#: ops/models/job.py:103 ops/models/job.py:189 ops/models/playbook.py:25 +#: ops/models/job.py:104 ops/models/job.py:190 ops/models/playbook.py:25 #: terminal/models/session/sharing.py:23 msgid "Creator" msgstr "作成者" @@ -3508,16 +3531,16 @@ msgstr "アカウント ポリシー" msgid "Last execution" msgstr "最後の実行" -#: ops/models/base.py:22 ops/serializers/job.py:18 +#: ops/models/base.py:22 ops/serializers/job.py:19 msgid "Date last run" msgstr "最終実行日" -#: ops/models/base.py:51 ops/models/job.py:187 +#: ops/models/base.py:51 ops/models/job.py:188 #: xpack/plugins/cloud/models.py:162 msgid "Result" msgstr "結果" -#: ops/models/base.py:52 ops/models/job.py:188 +#: ops/models/base.py:52 ops/models/job.py:189 msgid "Summary" msgstr "概要" @@ -3550,47 +3573,43 @@ msgstr "発売日" msgid "Celery Task Execution" msgstr "Celery タスク実行" -#: ops/models/job.py:97 +#: ops/models/job.py:98 msgid "Chdir" msgstr "実行ディレクトリ" -#: ops/models/job.py:98 +#: ops/models/job.py:99 msgid "Timeout (Seconds)" msgstr "タイムアウト(秒)" -#: ops/models/job.py:105 +#: ops/models/job.py:106 msgid "Use Parameter Define" msgstr "パラメータ定義を使用する" -#: ops/models/job.py:106 +#: ops/models/job.py:107 msgid "Parameters define" msgstr "パラメータ定義" -#: ops/models/job.py:107 +#: ops/models/job.py:108 msgid "Runas" msgstr "ユーザーとして実行" -#: ops/models/job.py:109 +#: ops/models/job.py:110 msgid "Runas policy" msgstr "ユーザー ポリシー" -#: ops/models/job.py:171 +#: ops/models/job.py:172 msgid "Job" msgstr "ジョブ#ジョブ#" -#: ops/models/job.py:186 -msgid "Parameters" -msgstr "パラメータ" - -#: ops/models/job.py:194 +#: ops/models/job.py:195 msgid "Material" msgstr "" -#: ops/models/job.py:196 +#: ops/models/job.py:197 msgid "Material Type" msgstr "" -#: ops/models/job.py:455 +#: ops/models/job.py:456 msgid "Job Execution" msgstr "ジョブ実行" @@ -3602,47 +3621,47 @@ msgstr "创建方式" msgid "VCS URL" msgstr "" -#: ops/notifications.py:17 +#: ops/notifications.py:18 msgid "Server performance" msgstr "サーバーのパフォーマンス" -#: ops/notifications.py:23 +#: ops/notifications.py:24 msgid "Terminal health check warning" msgstr "ターミナルヘルスチェックの警告" -#: ops/notifications.py:68 +#: ops/notifications.py:69 #, python-brace-format msgid "The terminal is offline: {name}" msgstr "ターミナルはオフラインです: {name}" -#: ops/notifications.py:73 +#: ops/notifications.py:74 #, python-brace-format msgid "Disk used more than {max_threshold}%: => {value}" msgstr "{max_threshold}%: => {value} を超えるディスクを使用" -#: ops/notifications.py:78 +#: ops/notifications.py:79 #, python-brace-format msgid "Memory used more than {max_threshold}%: => {value}" msgstr "{max_threshold}%: => {value} を超える使用メモリ" -#: ops/notifications.py:83 +#: ops/notifications.py:84 #, python-brace-format msgid "CPU load more than {max_threshold}: => {value}" msgstr "{max_threshold} を超えるCPUロード: => {value}" -#: ops/serializers/job.py:16 +#: ops/serializers/job.py:17 msgid "Run after save" msgstr "保存後に実行" -#: ops/serializers/job.py:64 +#: ops/serializers/job.py:70 msgid "Job type" msgstr "タスクの種類" -#: ops/serializers/job.py:67 terminal/serializers/session.py:49 +#: ops/serializers/job.py:73 terminal/serializers/session.py:49 msgid "Is finished" msgstr "終了しました" -#: ops/serializers/job.py:68 +#: ops/serializers/job.py:74 msgid "Time cost" msgstr "時を過ごす" @@ -3740,7 +3759,7 @@ msgstr "組織" msgid "Org name" msgstr "組織名" -#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:33 +#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:32 msgid "Builtin" msgstr "ビルトイン" @@ -3977,7 +3996,7 @@ msgstr "組織の役割バインディング" msgid "System role binding" msgstr "システムロールバインディング" -#: rbac/serializers/permission.py:26 users/serializers/profile.py:130 +#: rbac/serializers/permission.py:26 users/serializers/profile.py:132 msgid "Perms" msgstr "パーマ" @@ -3985,7 +4004,7 @@ msgstr "パーマ" msgid "Users amount" msgstr "ユーザー数" -#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:28 +#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:27 msgid "Display name" msgstr "表示名" @@ -4049,8 +4068,8 @@ msgstr "タスクセンター" msgid "My assets" msgstr "私の資産" -#: rbac/tree.py:56 terminal/models/applet/applet.py:43 -#: terminal/models/applet/applet.py:156 terminal/models/applet/host.py:28 +#: rbac/tree.py:56 terminal/models/applet/applet.py:42 +#: terminal/models/applet/applet.py:179 terminal/models/applet/host.py:28 #: terminal/serializers/applet.py:15 msgid "Applet" msgstr "リモートアプリケーション" @@ -4550,7 +4569,7 @@ msgid "SSO auth key TTL" msgstr "Token有効期間" #: settings/serializers/auth/sso.py:17 -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:194 msgid "Unit: second" msgstr "単位: 秒" @@ -5584,23 +5603,35 @@ msgstr "一括作成非サポート" msgid "Storage is invalid" msgstr "ストレージが無効です" -#: terminal/models/applet/applet.py:30 +#: terminal/models/applet/applet.py:29 msgid "Author" msgstr "著者" -#: terminal/models/applet/applet.py:35 +#: terminal/models/applet/applet.py:34 msgid "Tags" msgstr "ラベル" -#: terminal/models/applet/applet.py:39 terminal/serializers/storage.py:157 +#: terminal/models/applet/applet.py:38 terminal/serializers/storage.py:157 msgid "Hosts" msgstr "ホスト" -#: terminal/models/applet/applet.py:84 +#: terminal/models/applet/applet.py:83 msgid "Applet pkg not valid, Missing file {}" msgstr "無効なアプレット パッケージ、ファイル {} がありません" -#: terminal/models/applet/applet.py:158 terminal/models/applet/host.py:34 +#: terminal/models/applet/applet.py:102 +msgid "Load platform.yml failed: {}" +msgstr "" + +#: terminal/models/applet/applet.py:105 +msgid "Only support custom platform" +msgstr "" + +#: terminal/models/applet/applet.py:110 +msgid "Missing type in platform.yml" +msgstr "" + +#: terminal/models/applet/applet.py:181 terminal/models/applet/host.py:34 #: terminal/models/applet/host.py:106 msgid "Hosting" msgstr "ホスト マシン" @@ -5706,28 +5737,28 @@ msgid "Default storage" msgstr "デフォルトのストレージ" #: terminal/models/component/storage.py:140 -#: terminal/models/component/terminal.py:91 +#: terminal/models/component/terminal.py:90 msgid "Command storage" msgstr "コマンドストレージ" #: terminal/models/component/storage.py:200 -#: terminal/models/component/terminal.py:92 +#: terminal/models/component/terminal.py:91 msgid "Replay storage" msgstr "再生ストレージ" -#: terminal/models/component/terminal.py:88 +#: terminal/models/component/terminal.py:87 msgid "type" msgstr "タイプ" -#: terminal/models/component/terminal.py:90 terminal/serializers/command.py:51 +#: terminal/models/component/terminal.py:89 terminal/serializers/command.py:51 msgid "Remote Address" msgstr "リモートアドレス" -#: terminal/models/component/terminal.py:93 +#: terminal/models/component/terminal.py:92 msgid "Application User" msgstr "ユーザーの適用" -#: terminal/models/component/terminal.py:165 +#: terminal/models/component/terminal.py:164 msgid "Can view terminal config" msgstr "ターミナル構成を表示できます" @@ -6542,8 +6573,8 @@ msgstr "ここにid_rsa.pubを貼り付けます。" msgid "Public key should not be the same as your old one." msgstr "公開鍵は古いものと同じであってはなりません。" -#: users/forms/profile.py:159 users/serializers/profile.py:99 -#: users/serializers/profile.py:181 users/serializers/profile.py:208 +#: users/forms/profile.py:159 users/serializers/profile.py:100 +#: users/serializers/profile.py:183 users/serializers/profile.py:210 msgid "Not a valid ssh public key" msgstr "有効なssh公開鍵ではありません" @@ -6551,11 +6582,11 @@ msgstr "有効なssh公開鍵ではありません" msgid "Public key" msgstr "公開キー" -#: users/models/user.py:603 +#: users/models/user.py:603 users/serializers/profile.py:118 msgid "Force enable" msgstr "強制有効" -#: users/models/user.py:729 users/serializers/user.py:164 +#: users/models/user.py:729 users/serializers/user.py:171 msgid "Is service account" msgstr "サービスアカウントです" @@ -6567,7 +6598,7 @@ msgstr "アバター" msgid "Wechat" msgstr "微信" -#: users/models/user.py:737 +#: users/models/user.py:737 users/serializers/user.py:109 msgid "Phone" msgstr "電話" @@ -6583,8 +6614,8 @@ msgstr "ssh秘密鍵" msgid "Secret key" msgstr "秘密キー" -#: users/models/user.py:758 users/serializers/profile.py:147 -#: users/serializers/user.py:161 +#: users/models/user.py:758 users/serializers/profile.py:149 +#: users/serializers/user.py:168 msgid "Is first login" msgstr "最初のログインです" @@ -6655,7 +6686,7 @@ msgstr "MFAのリセット" msgid "The old password is incorrect" msgstr "古いパスワードが正しくありません" -#: users/serializers/profile.py:36 users/serializers/profile.py:195 +#: users/serializers/profile.py:36 users/serializers/profile.py:197 msgid "Password does not match security rules" msgstr "パスワードがセキュリティルールと一致しない" @@ -6663,61 +6694,61 @@ msgstr "パスワードがセキュリティルールと一致しない" msgid "The new password cannot be the last {} passwords" msgstr "新しいパスワードを最後の {} 個のパスワードにすることはできません" -#: users/serializers/profile.py:48 users/serializers/profile.py:70 +#: users/serializers/profile.py:48 users/serializers/profile.py:71 msgid "The newly set password is inconsistent" msgstr "新しく設定されたパスワードが一致しない" -#: users/serializers/user.py:39 +#: users/serializers/user.py:43 msgid "System roles" msgstr "システムの役割" -#: users/serializers/user.py:43 +#: users/serializers/user.py:47 msgid "Org roles" msgstr "組織ロール" -#: users/serializers/user.py:86 +#: users/serializers/user.py:90 msgid "Password strategy" msgstr "パスワード戦略" -#: users/serializers/user.py:88 +#: users/serializers/user.py:92 msgid "MFA enabled" msgstr "MFA有効化" -#: users/serializers/user.py:90 +#: users/serializers/user.py:94 msgid "MFA force enabled" msgstr "MFAフォース有効化" -#: users/serializers/user.py:92 +#: users/serializers/user.py:96 msgid "Login blocked" msgstr "ログインがロックされました" -#: users/serializers/user.py:95 users/serializers/user.py:169 +#: users/serializers/user.py:99 users/serializers/user.py:176 msgid "Is OTP bound" msgstr "仮想MFAがバインドされているか" -#: users/serializers/user.py:97 +#: users/serializers/user.py:101 msgid "Can public key authentication" msgstr "公開鍵認証が可能" -#: users/serializers/user.py:166 +#: users/serializers/user.py:173 msgid "Avatar url" msgstr "アバターURL" -#: users/serializers/user.py:171 +#: users/serializers/user.py:177 #, fuzzy #| msgid "One level" msgid "MFA level" msgstr "1つのレベル" -#: users/serializers/user.py:277 +#: users/serializers/user.py:283 msgid "Select users" msgstr "ユーザーの選択" -#: users/serializers/user.py:278 +#: users/serializers/user.py:284 msgid "For security, only list several users" msgstr "セキュリティのために、複数のユーザーのみをリストします" -#: users/serializers/user.py:311 +#: users/serializers/user.py:317 msgid "name not unique" msgstr "名前が一意ではない" @@ -7436,13 +7467,13 @@ msgstr "ファイルはJSON形式です。" msgid "IP address invalid `{}`, {}" msgstr "IPアドレスが無効: '{}', {}" -#: xpack/plugins/cloud/serializers/account_attrs.py:162 +#: xpack/plugins/cloud/serializers/account_attrs.py:172 msgid "" "Format for comma-delimited string,Such as: 192.168.1.0/24, " "10.0.0.0-10.0.0.255" msgstr "形式はコンマ区切りの文字列です,例:192.168.1.0/24,10.0.0.0-10.0.0.255" -#: xpack/plugins/cloud/serializers/account_attrs.py:166 +#: xpack/plugins/cloud/serializers/account_attrs.py:176 msgid "" "The port is used to detect the validity of the IP address. When the " "synchronization task is executed, only the valid IP address will be " @@ -7452,19 +7483,19 @@ msgstr "" "実行されると、有効な IP アドレスのみが同期されます。
ポートが0の場合、す" "べてのIPアドレスが有効です。" -#: xpack/plugins/cloud/serializers/account_attrs.py:174 +#: xpack/plugins/cloud/serializers/account_attrs.py:184 msgid "Hostname prefix" msgstr "ホスト名プレフィックス" -#: xpack/plugins/cloud/serializers/account_attrs.py:177 +#: xpack/plugins/cloud/serializers/account_attrs.py:187 msgid "IP segment" msgstr "IP セグメント" -#: xpack/plugins/cloud/serializers/account_attrs.py:181 +#: xpack/plugins/cloud/serializers/account_attrs.py:191 msgid "Test port" msgstr "テストポート" -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:194 msgid "Test timeout" msgstr "テストタイムアウト" @@ -7546,26 +7577,37 @@ msgstr "ライセンスのインポートに成功" msgid "License is invalid" msgstr "ライセンスが無効です" -#: xpack/plugins/license/meta.py:11 xpack/plugins/license/models.py:135 +#: xpack/plugins/license/meta.py:11 xpack/plugins/license/models.py:138 msgid "License" msgstr "ライセンス" -#: xpack/plugins/license/models.py:79 +#: xpack/plugins/license/models.py:80 msgid "Standard edition" msgstr "標準版" -#: xpack/plugins/license/models.py:81 +#: xpack/plugins/license/models.py:82 msgid "Enterprise edition" msgstr "エンタープライズ版" -#: xpack/plugins/license/models.py:83 +#: xpack/plugins/license/models.py:84 msgid "Ultimate edition" msgstr "究極のエディション" -#: xpack/plugins/license/models.py:85 +#: xpack/plugins/license/models.py:86 msgid "Community edition" msgstr "コミュニティ版" +#, fuzzy +#~| msgid "Parameters" +#~ msgid "Params" +#~ msgstr "パラメータ" + +#~ msgid "Auto fill" +#~ msgstr "自動充填" + +#~ msgid "Info" +#~ msgstr "情報" + #, fuzzy #~| msgid "Custom user" #~ msgid "Custom" diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 3dbd987da..7ae1a2fb3 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:035f9429613b541f229855a7d36c98e5f4736efce54dcd21119660dd6d89d94e -size 114269 +oid sha256:cb1b9a1cb886205fdd2320ddad5b3dea2e3bc15a76173ee0eab38c9c7b83739f +size 114597 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 29286bd92..b67a23cff 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-07 13:57+0800\n" +"POT-Creation-Date: 2023-04-19 12:58+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -27,7 +27,7 @@ msgstr "参数 'action' 必须是 [{}]" #: authentication/confirm/password.py:9 authentication/forms.py:32 #: authentication/templates/authentication/login.html:274 #: settings/serializers/auth/ldap.py:25 settings/serializers/auth/ldap.py:47 -#: users/forms/profile.py:22 users/serializers/user.py:101 +#: users/forms/profile.py:22 users/serializers/user.py:105 #: users/templates/users/_msg_user_created.html:13 #: users/templates/users/user_password_verify.html:18 #: xpack/plugins/cloud/serializers/account_attrs.py:28 @@ -69,17 +69,22 @@ msgstr "数据库" msgid "Collected" msgstr "收集" -#: accounts/const/account.py:24 ops/const.py:45 +#: accounts/const/account.py:21 accounts/serializers/account/account.py:25 +#: settings/serializers/auth/sms.py:75 +msgid "Template" +msgstr "模板" + +#: accounts/const/account.py:25 ops/const.py:45 msgid "Skip" msgstr "跳过" -#: accounts/const/account.py:25 audits/const.py:23 rbac/tree.py:229 +#: accounts/const/account.py:26 audits/const.py:23 rbac/tree.py:229 #: templates/_csv_import_export.html:18 templates/_csv_update_modal.html:6 msgid "Update" msgstr "更新" -#: accounts/const/account.py:26 -#: accounts/serializers/automations/change_secret.py:155 audits/const.py:53 +#: accounts/const/account.py:27 +#: accounts/serializers/automations/change_secret.py:156 audits/const.py:53 #: audits/signal_handlers/activity_log.py:33 common/const/choices.py:19 #: ops/const.py:58 terminal/const.py:60 xpack/plugins/cloud/const.py:41 msgid "Failed" @@ -175,16 +180,16 @@ msgstr "仅创建" #: accounts/models/account.py:47 #: accounts/models/automations/gather_account.py:16 -#: accounts/serializers/account/account.py:173 -#: accounts/serializers/account/account.py:206 +#: accounts/serializers/account/account.py:199 +#: accounts/serializers/account/account.py:232 #: accounts/serializers/account/gathered_account.py:10 -#: accounts/serializers/automations/change_secret.py:111 -#: accounts/serializers/automations/change_secret.py:131 +#: accounts/serializers/automations/change_secret.py:112 +#: accounts/serializers/automations/change_secret.py:132 #: acls/models/base.py:100 acls/serializers/base.py:56 -#: assets/models/asset/common.py:92 assets/models/asset/common.py:268 +#: assets/models/asset/common.py:92 assets/models/asset/common.py:306 #: assets/models/cmd_filter.py:36 assets/serializers/domain.py:19 #: assets/serializers/label.py:27 audits/models.py:48 -#: authentication/models/connection_token.py:33 +#: authentication/models/connection_token.py:34 #: perms/models/asset_permission.py:64 perms/serializers/permission.py:34 #: terminal/backends/command/models.py:20 terminal/models/session/session.py:32 #: terminal/notifications.py:95 terminal/serializers/command.py:17 @@ -192,17 +197,17 @@ msgstr "仅创建" msgid "Asset" msgstr "资产" -#: accounts/models/account.py:51 accounts/serializers/account/account.py:178 -#: authentication/serializers/connect_token_secret.py:48 +#: accounts/models/account.py:51 accounts/serializers/account/account.py:204 +#: authentication/serializers/connect_token_secret.py:49 msgid "Su from" msgstr "切换自" #: accounts/models/account.py:53 settings/serializers/auth/cas.py:20 -#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:29 +#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:28 msgid "Version" msgstr "版本" -#: accounts/models/account.py:55 accounts/serializers/account/account.py:174 +#: accounts/models/account.py:55 accounts/serializers/account/account.py:200 #: users/models/user.py:768 msgid "Source" msgstr "来源" @@ -212,10 +217,10 @@ msgid "Source ID" msgstr "来源 ID" #: accounts/models/account.py:59 -#: accounts/serializers/automations/change_secret.py:112 -#: accounts/serializers/automations/change_secret.py:132 +#: accounts/serializers/automations/change_secret.py:113 +#: accounts/serializers/automations/change_secret.py:133 #: acls/models/base.py:102 acls/serializers/base.py:57 -#: assets/serializers/asset/common.py:107 assets/serializers/gateway.py:28 +#: assets/serializers/asset/common.py:124 assets/serializers/gateway.py:28 #: audits/models.py:49 ops/models/base.py:18 #: perms/models/asset_permission.py:70 perms/serializers/permission.py:39 #: terminal/backends/command/models.py:21 terminal/models/session/session.py:34 @@ -268,8 +273,8 @@ msgid "Account backup plan" msgstr "账号备份计划" #: accounts/models/automations/backup_account.py:83 -#: assets/models/automations/base.py:114 audits/models.py:55 -#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:191 +#: assets/models/automations/base.py:115 audits/models.py:55 +#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:192 #: perms/models/asset_permission.py:72 terminal/models/applet/host.py:109 #: terminal/models/session/session.py:45 #: tickets/models/ticket/apply_application.py:30 @@ -290,7 +295,7 @@ msgstr "账号备份快照" #: accounts/models/automations/backup_account.py:94 #: accounts/serializers/account/backup.py:42 #: accounts/serializers/automations/base.py:55 -#: assets/models/automations/base.py:121 +#: assets/models/automations/base.py:122 #: assets/serializers/automations/base.py:40 msgid "Trigger mode" msgstr "触发模式" @@ -301,9 +306,9 @@ msgid "Reason" msgstr "原因" #: accounts/models/automations/backup_account.py:99 -#: accounts/serializers/automations/change_secret.py:110 -#: accounts/serializers/automations/change_secret.py:133 -#: ops/serializers/job.py:66 terminal/serializers/session.py:45 +#: accounts/serializers/automations/change_secret.py:111 +#: accounts/serializers/automations/change_secret.py:134 +#: ops/serializers/job.py:72 terminal/serializers/session.py:45 msgid "Is success" msgstr "是否成功" @@ -348,11 +353,11 @@ msgid "Can add push account execution" msgstr "创建推送账号执行" #: accounts/models/automations/change_secret.py:18 accounts/models/base.py:36 -#: accounts/serializers/account/account.py:383 +#: accounts/serializers/account/account.py:394 #: accounts/serializers/account/base.py:16 #: accounts/serializers/automations/change_secret.py:46 -#: authentication/serializers/connect_token_secret.py:40 -#: authentication/serializers/connect_token_secret.py:49 +#: authentication/serializers/connect_token_secret.py:41 +#: authentication/serializers/connect_token_secret.py:50 msgid "Secret type" msgstr "密文类型" @@ -391,14 +396,14 @@ msgid "Date started" msgstr "开始日期" #: accounts/models/automations/change_secret.py:92 -#: assets/models/automations/base.py:115 ops/models/base.py:56 -#: ops/models/celery.py:64 ops/models/job.py:192 +#: assets/models/automations/base.py:116 ops/models/base.py:56 +#: ops/models/celery.py:64 ops/models/job.py:193 #: terminal/models/applet/host.py:110 msgid "Date finished" msgstr "结束日期" #: accounts/models/automations/change_secret.py:94 -#: accounts/serializers/account/account.py:208 assets/const/automation.py:8 +#: accounts/serializers/account/account.py:234 assets/const/automation.py:8 #: common/const/choices.py:20 msgid "Error" msgstr "错误" @@ -452,12 +457,12 @@ msgstr "触发方式" #: accounts/models/automations/push_account.py:16 acls/models/base.py:81 #: acls/serializers/base.py:81 acls/serializers/login_acl.py:25 #: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82 -#: authentication/serializers/connect_token_secret.py:107 +#: authentication/serializers/connect_token_secret.py:108 #: authentication/templates/authentication/_access_key_modal.html:34 msgid "Action" msgstr "动作" -#: accounts/models/automations/push_account.py:59 +#: accounts/models/automations/push_account.py:60 msgid "Push asset account" msgstr "账号推送" @@ -468,21 +473,21 @@ msgstr "账号验证" #: accounts/models/base.py:33 acls/models/base.py:75 #: acls/models/command_acl.py:21 acls/serializers/base.py:34 #: applications/models.py:9 assets/models/_user.py:22 -#: assets/models/asset/common.py:90 assets/models/asset/common.py:102 +#: assets/models/asset/common.py:90 assets/models/asset/common.py:123 #: assets/models/cmd_filter.py:21 assets/models/domain.py:18 #: assets/models/group.py:20 assets/models/label.py:18 -#: assets/models/platform.py:13 assets/models/platform.py:65 -#: assets/serializers/asset/common.py:128 assets/serializers/platform.py:93 -#: assets/serializers/platform.py:184 -#: authentication/serializers/connect_token_secret.py:101 ops/mixin.py:21 +#: assets/models/platform.py:13 assets/models/platform.py:89 +#: assets/serializers/asset/common.py:144 assets/serializers/platform.py:99 +#: assets/serializers/platform.py:200 +#: authentication/serializers/connect_token_secret.py:102 ops/mixin.py:21 #: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57 -#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19 +#: ops/models/job.py:92 ops/models/playbook.py:23 ops/serializers/job.py:20 #: orgs/models.py:69 perms/models/asset_permission.py:56 rbac/models/role.py:29 #: settings/models.py:33 settings/serializers/sms.py:6 -#: terminal/models/applet/applet.py:27 terminal/models/component/endpoint.py:12 +#: terminal/models/applet/applet.py:26 terminal/models/component/endpoint.py:12 #: terminal/models/component/endpoint.py:90 #: terminal/models/component/storage.py:26 terminal/models/component/task.py:15 -#: terminal/models/component/terminal.py:85 users/forms/profile.py:33 +#: terminal/models/component/terminal.py:84 users/forms/profile.py:33 #: users/models/group.py:13 users/models/user.py:717 #: xpack/plugins/cloud/models.py:28 msgid "Name" @@ -492,11 +497,11 @@ msgstr "名称" msgid "Privileged" msgstr "特权账号" -#: accounts/models/base.py:40 assets/models/asset/common.py:109 +#: accounts/models/base.py:40 assets/models/asset/common.py:130 #: assets/models/automations/base.py:21 assets/models/cmd_filter.py:39 #: assets/models/label.py:22 -#: authentication/serializers/connect_token_secret.py:105 -#: terminal/models/applet/applet.py:32 users/serializers/user.py:162 +#: authentication/serializers/connect_token_secret.py:106 +#: terminal/models/applet/applet.py:31 users/serializers/user.py:169 msgid "Is active" msgstr "激活" @@ -538,37 +543,32 @@ msgstr "" "{} - 改密任务已完成: 未设置加密密码 - 请前往个人信息 -> 文件加密密码中设置加" "密密码" -#: accounts/serializers/account/account.py:26 -#: settings/serializers/auth/sms.py:75 -msgid "Template" -msgstr "模板" - -#: accounts/serializers/account/account.py:29 +#: accounts/serializers/account/account.py:28 msgid "Push now" msgstr "立即推送" -#: accounts/serializers/account/account.py:33 +#: accounts/serializers/account/account.py:35 msgid "Exist policy" msgstr "账号存在策略" -#: accounts/serializers/account/account.py:153 applications/models.py:11 -#: assets/models/label.py:21 assets/models/platform.py:66 -#: assets/serializers/asset/common.py:103 assets/serializers/cagegory.py:8 -#: assets/serializers/platform.py:111 assets/serializers/platform.py:185 +#: accounts/serializers/account/account.py:179 applications/models.py:11 +#: assets/models/label.py:21 assets/models/platform.py:90 +#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8 +#: assets/serializers/platform.py:117 assets/serializers/platform.py:201 #: perms/serializers/user_permission.py:26 settings/models.py:35 #: tickets/models/ticket/apply_application.py:13 msgid "Category" msgstr "类别" -#: accounts/serializers/account/account.py:154 +#: accounts/serializers/account/account.py:180 #: accounts/serializers/automations/base.py:54 acls/models/command_acl.py:24 #: acls/serializers/command_acl.py:18 applications/models.py:14 #: assets/models/_user.py:50 assets/models/automations/base.py:20 -#: assets/models/cmd_filter.py:74 assets/models/platform.py:67 -#: assets/serializers/asset/common.py:104 assets/serializers/platform.py:95 -#: assets/serializers/platform.py:110 audits/serializers.py:48 -#: authentication/serializers/connect_token_secret.py:114 ops/models/job.py:102 -#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31 +#: assets/models/cmd_filter.py:74 assets/models/platform.py:91 +#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:101 +#: assets/serializers/platform.py:116 audits/serializers.py:48 +#: authentication/serializers/connect_token_secret.py:115 ops/models/job.py:103 +#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:30 #: terminal/models/component/storage.py:57 #: terminal/models/component/storage.py:146 terminal/serializers/applet.py:29 #: terminal/serializers/session.py:22 terminal/serializers/storage.py:224 @@ -579,53 +579,53 @@ msgstr "类别" msgid "Type" msgstr "类型" -#: accounts/serializers/account/account.py:169 +#: accounts/serializers/account/account.py:195 msgid "Asset not found" msgstr "资产不存在" -#: accounts/serializers/account/account.py:175 +#: accounts/serializers/account/account.py:201 #: accounts/serializers/account/base.py:64 msgid "Has secret" msgstr "已托管密码" -#: accounts/serializers/account/account.py:207 ops/models/celery.py:60 +#: accounts/serializers/account/account.py:233 ops/models/celery.py:60 #: tickets/models/comment.py:13 tickets/models/ticket/general.py:45 #: tickets/models/ticket/general.py:279 tickets/serializers/super_ticket.py:14 #: tickets/serializers/ticket/ticket.py:21 msgid "State" msgstr "状态" -#: accounts/serializers/account/account.py:209 +#: accounts/serializers/account/account.py:235 msgid "Changed" msgstr "已修改" -#: accounts/serializers/account/account.py:213 +#: accounts/serializers/account/account.py:241 #: accounts/serializers/automations/base.py:22 #: assets/models/automations/base.py:19 #: assets/serializers/automations/base.py:20 ops/models/base.py:17 -#: ops/models/job.py:104 ops/serializers/job.py:20 +#: ops/models/job.py:105 ops/serializers/job.py:21 #: terminal/templates/terminal/_msg_command_execute_alert.html:16 msgid "Assets" msgstr "资产" -#: accounts/serializers/account/account.py:284 +#: accounts/serializers/account/account.py:293 msgid "Account already exists" msgstr "账号已存在" -#: accounts/serializers/account/account.py:320 +#: accounts/serializers/account/account.py:330 #, python-format msgid "Asset does not support this secret type: %s" msgstr "资产不支持账号类型: %s" -#: accounts/serializers/account/account.py:351 +#: accounts/serializers/account/account.py:361 msgid "Account has exist" msgstr "账号已存在" -#: accounts/serializers/account/account.py:393 acls/models/base.py:98 +#: accounts/serializers/account/account.py:401 acls/models/base.py:98 #: acls/models/login_acl.py:13 acls/serializers/base.py:55 #: acls/serializers/login_acl.py:21 assets/models/cmd_filter.py:24 #: assets/models/label.py:16 audits/models.py:44 audits/models.py:63 -#: audits/models.py:141 authentication/models/connection_token.py:29 +#: audits/models.py:141 authentication/models/connection_token.py:30 #: authentication/models/sso_token.py:16 #: notifications/models/notification.py:12 #: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58 @@ -639,7 +639,7 @@ msgstr "账号已存在" msgid "User" msgstr "用户" -#: accounts/serializers/account/account.py:394 +#: accounts/serializers/account/account.py:402 #: authentication/templates/authentication/_access_key_modal.html:33 #: terminal/notifications.py:98 terminal/notifications.py:146 msgid "Date" @@ -671,12 +671,12 @@ msgid "Key password" msgstr "密钥密码" #: accounts/serializers/account/base.py:80 -#: assets/serializers/asset/common.py:298 +#: assets/serializers/asset/common.py:304 msgid "Spec info" msgstr "特殊信息" #: accounts/serializers/automations/base.py:23 -#: assets/models/asset/common.py:108 assets/models/automations/base.py:18 +#: assets/models/asset/common.py:129 assets/models/automations/base.py:18 #: assets/models/cmd_filter.py:32 assets/serializers/automations/base.py:21 #: perms/models/asset_permission.py:67 msgid "Nodes" @@ -687,7 +687,7 @@ msgid "Name already exists" msgstr "名称已存在" #: accounts/serializers/automations/base.py:53 -#: assets/models/automations/base.py:117 +#: assets/models/automations/base.py:118 #: assets/serializers/automations/base.py:39 msgid "Automation snapshot" msgstr "自动化快照" @@ -696,20 +696,20 @@ msgstr "自动化快照" msgid "SSH Key strategy" msgstr "SSH 密钥更改方式" -#: accounts/serializers/automations/change_secret.py:80 +#: accounts/serializers/automations/change_secret.py:81 msgid "* Please enter the correct password length" msgstr "* 请输入正确的密码长度" -#: accounts/serializers/automations/change_secret.py:84 +#: accounts/serializers/automations/change_secret.py:85 msgid "* Password length range 6-30 bits" msgstr "* 密码长度范围 6-30 位" -#: accounts/serializers/automations/change_secret.py:114 -#: assets/models/automations/base.py:126 +#: accounts/serializers/automations/change_secret.py:115 +#: assets/models/automations/base.py:127 msgid "Automation task execution" msgstr "自动化任务执行历史" -#: accounts/serializers/automations/change_secret.py:154 audits/const.py:52 +#: accounts/serializers/automations/change_secret.py:155 audits/const.py:52 #: audits/models.py:54 audits/signal_handlers/activity_log.py:33 #: common/const/choices.py:18 ops/const.py:56 ops/serializers/celery.py:39 #: terminal/const.py:59 terminal/models/session/sharing.py:107 @@ -786,12 +786,12 @@ msgstr "优先级可选范围为 1-100 (数值越小越优先)" #: acls/models/base.py:82 acls/serializers/base.py:75 #: acls/serializers/login_acl.py:23 assets/models/cmd_filter.py:86 -#: authentication/serializers/connect_token_secret.py:79 +#: authentication/serializers/connect_token_secret.py:80 msgid "Reviewers" msgstr "审批人" #: acls/models/base.py:83 authentication/models/access_key.py:17 -#: authentication/models/connection_token.py:48 +#: authentication/models/connection_token.py:49 #: authentication/templates/authentication/_access_key_modal.html:32 #: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:27 #: tickets/const.py:37 @@ -799,7 +799,7 @@ msgid "Active" msgstr "激活中" #: acls/models/command_acl.py:16 assets/models/cmd_filter.py:60 -#: ops/serializers/job.py:65 terminal/const.py:67 +#: ops/serializers/job.py:71 terminal/const.py:67 #: terminal/models/session/session.py:43 terminal/serializers/command.py:18 #: terminal/templates/terminal/_msg_command_alert.html:12 #: terminal/templates/terminal/_msg_command_execute_alert.html:10 @@ -811,7 +811,7 @@ msgid "Regex" msgstr "正则表达式" #: acls/models/command_acl.py:26 assets/models/cmd_filter.py:79 -#: settings/serializers/basic.py:10 xpack/plugins/license/models.py:29 +#: settings/serializers/basic.py:10 xpack/plugins/license/models.py:30 msgid "Content" msgstr "内容" @@ -825,7 +825,7 @@ msgstr "忽略大小写" #: acls/models/command_acl.py:33 acls/models/command_acl.py:96 #: acls/serializers/command_acl.py:28 -#: authentication/serializers/connect_token_secret.py:76 +#: authentication/serializers/connect_token_secret.py:77 msgid "Command group" msgstr "命令组" @@ -874,7 +874,7 @@ msgstr "" "格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " "10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)" -#: acls/serializers/base.py:40 assets/serializers/asset/host.py:35 +#: acls/serializers/base.py:40 assets/serializers/asset/host.py:19 msgid "IP/Host" msgstr "IP/主机" @@ -953,7 +953,7 @@ msgstr "应用程序" msgid "Can match application" msgstr "匹配应用" -#: assets/api/asset/asset.py:147 +#: assets/api/asset/asset.py:141 msgid "Cannot create asset directly, you should create a host or other" msgstr "不能直接创建资产, 你应该创建主机或其他资产" @@ -977,12 +977,12 @@ msgstr "删除失败,节点包含资产" msgid "App assets" msgstr "资产管理" -#: assets/automations/base/manager.py:113 +#: assets/automations/base/manager.py:136 msgid "{} disabled" msgstr "{} 已禁用" #: assets/automations/ping_gateway/manager.py:33 -#: authentication/models/connection_token.py:114 +#: authentication/models/connection_token.py:115 msgid "No account" msgstr "没有账号" @@ -1039,7 +1039,7 @@ msgid "Device" msgstr "网络设备" #: assets/const/category.py:12 assets/models/asset/database.py:9 -#: assets/models/asset/database.py:24 assets/serializers/asset/common.py:91 +#: assets/models/asset/database.py:24 msgid "Database" msgstr "数据库" @@ -1048,7 +1048,7 @@ msgid "Cloud service" msgstr "云服务" #: assets/const/category.py:14 assets/models/asset/web.py:16 audits/const.py:33 -#: terminal/models/applet/applet.py:25 +#: terminal/models/applet/applet.py:24 msgid "Web" msgstr "Web" @@ -1068,7 +1068,7 @@ msgstr "私有云" msgid "Kubernetes" msgstr "" -#: assets/const/device.py:7 terminal/models/applet/applet.py:24 +#: assets/const/device.py:7 terminal/models/applet/applet.py:23 #: tickets/const.py:8 msgid "General" msgstr "一般" @@ -1089,7 +1089,7 @@ msgstr "防火墙" msgid "Other" msgstr "其它" -#: assets/const/types.py:214 +#: assets/const/types.py:215 msgid "All types" msgstr "所有类型" @@ -1107,7 +1107,7 @@ msgid "Basic" msgstr "基本" #: assets/const/web.py:61 assets/models/asset/web.py:13 -#: assets/serializers/asset/common.py:99 assets/serializers/platform.py:40 +#: assets/serializers/platform.py:40 msgid "Script" msgstr "脚本" @@ -1125,9 +1125,9 @@ msgstr "SSH公钥" #: assets/models/_user.py:27 assets/models/cmd_filter.py:40 #: assets/models/cmd_filter.py:88 assets/models/group.py:23 -#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:110 +#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:111 #: ops/models/playbook.py:26 rbac/models/role.py:37 settings/models.py:38 -#: terminal/models/applet/applet.py:36 terminal/models/applet/applet.py:160 +#: terminal/models/applet/applet.py:35 terminal/models/applet/applet.py:183 #: terminal/models/applet/host.py:111 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 @@ -1136,9 +1136,9 @@ msgstr "SSH公钥" msgid "Comment" msgstr "备注" -#: assets/models/_user.py:28 assets/models/automations/base.py:113 +#: assets/models/_user.py:28 assets/models/automations/base.py:114 #: assets/models/cmd_filter.py:41 assets/models/group.py:22 -#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:190 +#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:191 #: users/models/user.py:943 msgid "Date created" msgstr "创建日期" @@ -1175,9 +1175,9 @@ msgstr "特权用户" msgid "Username same with user" msgstr "用户名与用户相同" -#: assets/models/_user.py:52 authentication/models/connection_token.py:38 -#: authentication/serializers/connect_token_secret.py:102 -#: terminal/models/applet/applet.py:34 terminal/serializers/session.py:20 +#: assets/models/_user.py:52 authentication/models/connection_token.py:39 +#: authentication/serializers/connect_token_secret.py:103 +#: terminal/models/applet/applet.py:33 terminal/serializers/session.py:20 #: terminal/serializers/session.py:41 terminal/serializers/storage.py:68 msgid "Protocol" msgstr "协议" @@ -1236,53 +1236,50 @@ msgstr "云服务" msgid "Port" msgstr "端口" -#: assets/models/asset/common.py:103 assets/serializers/asset/common.py:129 +#: assets/models/asset/common.py:124 assets/serializers/asset/common.py:145 msgid "Address" msgstr "地址" -#: assets/models/asset/common.py:104 assets/models/platform.py:100 -#: authentication/serializers/connect_token_secret.py:106 +#: assets/models/asset/common.py:125 assets/models/platform.py:120 +#: authentication/serializers/connect_token_secret.py:107 #: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:187 +#: xpack/plugins/cloud/serializers/account_attrs.py:197 msgid "Platform" msgstr "系统平台" -#: assets/models/asset/common.py:106 assets/models/domain.py:21 -#: authentication/serializers/connect_token_secret.py:124 +#: assets/models/asset/common.py:127 assets/models/domain.py:21 +#: authentication/serializers/connect_token_secret.py:125 #: perms/serializers/user_permission.py:28 msgid "Domain" msgstr "网域" -#: assets/models/asset/common.py:110 +#: assets/models/asset/common.py:131 msgid "Labels" msgstr "标签管理" -#: assets/models/asset/common.py:111 -#, fuzzy -#| msgid "Gather asset hardware info" +#: assets/models/asset/common.py:132 assets/serializers/asset/common.py:305 +#: assets/serializers/asset/host.py:11 msgid "Gathered info" msgstr "收集资产硬件信息" -#: assets/models/asset/common.py:112 assets/serializers/asset/common.py:109 -#: assets/serializers/asset/common.py:179 -#, fuzzy -#| msgid "Auto info" +#: assets/models/asset/common.py:133 assets/serializers/asset/custom.py:14 +#: assets/serializers/asset/custom.py:22 msgid "Custom info" msgstr "自动化信息" -#: assets/models/asset/common.py:271 +#: assets/models/asset/common.py:309 msgid "Can refresh asset hardware info" msgstr "可以更新资产硬件信息" -#: assets/models/asset/common.py:272 +#: assets/models/asset/common.py:310 msgid "Can test asset connectivity" msgstr "可以测试资产连接性" -#: assets/models/asset/common.py:273 +#: assets/models/asset/common.py:311 msgid "Can match asset" msgstr "可以匹配资产" -#: assets/models/asset/common.py:274 +#: assets/models/asset/common.py:312 msgid "Can change asset nodes" msgstr "可以修改资产节点" @@ -1290,7 +1287,7 @@ msgstr "可以修改资产节点" msgid "Custom asset" msgstr "自定义资产" -#: assets/models/asset/database.py:10 assets/serializers/asset/common.py:92 +#: assets/models/asset/database.py:10 assets/serializers/platform.py:45 #: settings/serializers/email.py:37 msgid "Use SSL" msgstr "使用 SSL" @@ -1307,7 +1304,7 @@ msgstr "客户端证书" msgid "Client key" msgstr "客户端密钥" -#: assets/models/asset/database.py:14 assets/serializers/asset/common.py:93 +#: assets/models/asset/database.py:14 msgid "Allow invalid cert" msgstr "忽略证书校验" @@ -1315,37 +1312,38 @@ msgstr "忽略证书校验" msgid "Autofill" msgstr "自动代填" -#: assets/models/asset/web.py:10 assets/serializers/asset/common.py:96 -#: assets/serializers/platform.py:32 +#: assets/models/asset/web.py:10 assets/serializers/platform.py:32 msgid "Username selector" msgstr "用户名选择器" -#: assets/models/asset/web.py:11 assets/serializers/asset/common.py:97 -#: assets/serializers/platform.py:35 +#: assets/models/asset/web.py:11 assets/serializers/platform.py:35 msgid "Password selector" msgstr "密码选择器" -#: assets/models/asset/web.py:12 assets/serializers/asset/common.py:98 -#: assets/serializers/platform.py:38 +#: assets/models/asset/web.py:12 assets/serializers/platform.py:38 msgid "Submit selector" msgstr "确认按钮选择器" #: assets/models/automations/base.py:17 assets/models/cmd_filter.py:38 -#: assets/serializers/asset/common.py:297 rbac/tree.py:35 +#: assets/serializers/asset/common.py:303 rbac/tree.py:35 msgid "Accounts" msgstr "账号管理" -#: assets/models/automations/base.py:28 assets/models/automations/base.py:110 +#: assets/models/automations/base.py:22 ops/models/job.py:187 +msgid "Parameters" +msgstr "参数" + +#: assets/models/automations/base.py:29 assets/models/automations/base.py:111 msgid "Automation task" msgstr "自动化任务" -#: assets/models/automations/base.py:103 +#: assets/models/automations/base.py:104 msgid "Asset automation task" msgstr "资产自动化任务" -#: assets/models/automations/base.py:112 audits/models.py:177 -#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:183 -#: terminal/models/applet/applet.py:159 terminal/models/applet/host.py:108 +#: assets/models/automations/base.py:113 audits/models.py:177 +#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:184 +#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:108 #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:103 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 @@ -1413,7 +1411,7 @@ msgid "Asset group" msgstr "资产组" #: assets/models/group.py:34 assets/models/platform.py:17 -#: assets/serializers/platform.py:97 +#: assets/serializers/platform.py:102 #: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "默认" @@ -1428,17 +1426,17 @@ msgstr "系统" #: assets/models/label.py:19 assets/models/node.py:544 #: assets/serializers/cagegory.py:7 assets/serializers/cagegory.py:14 -#: authentication/models/connection_token.py:26 -#: authentication/serializers/connect_token_secret.py:113 -#: common/serializers/common.py:80 settings/models.py:34 +#: authentication/models/connection_token.py:27 +#: authentication/serializers/connect_token_secret.py:114 +#: common/serializers/common.py:86 settings/models.py:34 msgid "Value" msgstr "值" -#: assets/models/label.py:40 assets/serializers/asset/common.py:105 +#: assets/models/label.py:40 assets/serializers/asset/common.py:122 #: assets/serializers/cagegory.py:6 assets/serializers/cagegory.py:13 -#: assets/serializers/platform.py:94 -#: authentication/serializers/connect_token_secret.py:112 -#: common/serializers/common.py:79 settings/serializers/sms.py:7 +#: assets/serializers/platform.py:100 +#: authentication/serializers/connect_token_secret.py:113 +#: common/serializers/common.py:85 settings/serializers/sms.py:7 msgid "Label" msgstr "标签" @@ -1488,86 +1486,102 @@ msgstr "开放的" msgid "Setting" msgstr "设置" -#: assets/models/platform.py:31 audits/const.py:47 settings/models.py:37 +#: assets/models/platform.py:39 audits/const.py:47 settings/models.py:37 #: terminal/serializers/applet_host.py:29 msgid "Enabled" msgstr "启用" -#: assets/models/platform.py:32 +#: assets/models/platform.py:40 msgid "Ansible config" msgstr "Ansible 配置" -#: assets/models/platform.py:33 assets/serializers/platform.py:60 +#: assets/models/platform.py:42 assets/serializers/platform.py:63 msgid "Ping enabled" msgstr "启用资产探活" -#: assets/models/platform.py:34 assets/serializers/platform.py:61 +#: assets/models/platform.py:43 assets/serializers/platform.py:64 msgid "Ping method" msgstr "资产探活方式" -#: assets/models/platform.py:35 assets/models/platform.py:48 -#: assets/serializers/platform.py:62 +#: assets/models/platform.py:44 +msgid "Ping params" +msgstr "资产探活参数" + +#: assets/models/platform.py:46 assets/models/platform.py:70 +#: assets/serializers/platform.py:65 msgid "Gather facts enabled" msgstr "启用收集资产信息" -#: assets/models/platform.py:36 assets/models/platform.py:50 -#: assets/serializers/platform.py:63 +#: assets/models/platform.py:48 assets/models/platform.py:72 +#: assets/serializers/platform.py:66 msgid "Gather facts method" msgstr "收集信息方式" -#: assets/models/platform.py:37 assets/serializers/platform.py:66 +#: assets/models/platform.py:50 assets/models/platform.py:74 +msgid "Gather facts params" +msgstr "收集信息参数" + +#: assets/models/platform.py:52 assets/serializers/platform.py:69 msgid "Change secret enabled" msgstr "启用改密" -#: assets/models/platform.py:39 assets/serializers/platform.py:67 +#: assets/models/platform.py:54 assets/serializers/platform.py:70 msgid "Change secret method" msgstr "改密方式" -#: assets/models/platform.py:41 assets/serializers/platform.py:68 +#: assets/models/platform.py:56 +msgid "Change secret params" +msgstr "改密参数" + +#: assets/models/platform.py:58 assets/serializers/platform.py:71 msgid "Push account enabled" msgstr "启用账号推送" -#: assets/models/platform.py:43 assets/serializers/platform.py:69 +#: assets/models/platform.py:60 assets/serializers/platform.py:72 msgid "Push account method" msgstr "账号推送方式" -#: assets/models/platform.py:45 assets/serializers/platform.py:64 +#: assets/models/platform.py:62 +msgid "Push account params" +msgstr "账号推送参数" + +#: assets/models/platform.py:64 assets/serializers/platform.py:67 msgid "Verify account enabled" msgstr "开启账号验证" -#: assets/models/platform.py:47 assets/serializers/platform.py:65 +#: assets/models/platform.py:66 assets/serializers/platform.py:68 msgid "Verify account method" msgstr "账号验证方式" -#: assets/models/platform.py:68 tickets/models/ticket/general.py:300 +#: assets/models/platform.py:68 +msgid "Verify account params" +msgstr "账号验证参数" + +#: assets/models/platform.py:92 tickets/models/ticket/general.py:300 msgid "Meta" msgstr "元数据" -#: assets/models/platform.py:69 +#: assets/models/platform.py:93 msgid "Internal" msgstr "内置" -#: assets/models/platform.py:73 assets/serializers/platform.py:109 +#: assets/models/platform.py:97 assets/serializers/platform.py:115 msgid "Charset" msgstr "编码" -#: assets/models/platform.py:75 assets/serializers/platform.py:133 +#: assets/models/platform.py:99 assets/serializers/platform.py:142 msgid "Domain enabled" msgstr "启用网域" -#: assets/models/platform.py:77 assets/serializers/platform.py:132 +#: assets/models/platform.py:101 assets/serializers/platform.py:141 msgid "Su enabled" msgstr "启用账号切换" -#: assets/models/platform.py:78 assets/serializers/platform.py:115 +#: assets/models/platform.py:102 assets/serializers/platform.py:121 msgid "Su method" msgstr "账号切换方式" -#: assets/models/platform.py:81 assets/serializers/platform.py:113 -msgid "Automation" -msgstr "自动化" - -#: assets/models/platform.py:83 assets/serializers/platform.py:118 +#: assets/models/platform.py:103 assets/serializers/platform.py:124 msgid "Custom fields" msgstr "自定义属性" @@ -1582,40 +1596,36 @@ msgid "" "type" msgstr "资产中批量更新平台,不符合平台类型跳过的资产" -#: assets/serializers/asset/common.py:95 -msgid "Auto fill" -msgstr "自动代填" - -#: assets/serializers/asset/common.py:106 assets/serializers/platform.py:112 +#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:118 #: authentication/serializers/connect_token_secret.py:29 -#: authentication/serializers/connect_token_secret.py:63 +#: authentication/serializers/connect_token_secret.py:64 #: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99 msgid "Protocols" msgstr "协议组" -#: assets/serializers/asset/common.py:108 -#: assets/serializers/asset/common.py:130 +#: assets/serializers/asset/common.py:125 +#: assets/serializers/asset/common.py:146 msgid "Node path" msgstr "节点路径" -#: assets/serializers/asset/common.py:127 -#: assets/serializers/asset/common.py:299 +#: assets/serializers/asset/common.py:143 +#: assets/serializers/asset/common.py:306 msgid "Auto info" msgstr "自动化信息" -#: assets/serializers/asset/common.py:220 +#: assets/serializers/asset/common.py:225 msgid "Platform not exist" msgstr "平台不存在" -#: assets/serializers/asset/common.py:255 +#: assets/serializers/asset/common.py:261 msgid "port out of range (1-65535)" msgstr "端口超出范围 (1-65535)" -#: assets/serializers/asset/common.py:262 +#: assets/serializers/asset/common.py:268 msgid "Protocol is required: {}" msgstr "协议是必填的: {}" -#: assets/serializers/asset/database.py:25 common/serializers/fields.py:100 +#: assets/serializers/asset/database.py:25 common/serializers/fields.py:102 #: tickets/serializers/ticket/common.py:58 #: xpack/plugins/cloud/serializers/account_attrs.py:56 #: xpack/plugins/cloud/serializers/account_attrs.py:79 @@ -1623,59 +1633,56 @@ msgstr "协议是必填的: {}" msgid "This field is required." msgstr "该字段是必填项。" -#: assets/serializers/asset/host.py:11 +#: assets/serializers/asset/info/gathered.py:6 msgid "Vendor" msgstr "制造商" -#: assets/serializers/asset/host.py:12 +#: assets/serializers/asset/info/gathered.py:7 msgid "Model" msgstr "型号" -#: assets/serializers/asset/host.py:13 tickets/models/ticket/general.py:299 +#: assets/serializers/asset/info/gathered.py:8 +#: tickets/models/ticket/general.py:299 msgid "Serial number" msgstr "序列号" -#: assets/serializers/asset/host.py:14 +#: assets/serializers/asset/info/gathered.py:9 msgid "CPU model" msgstr "CPU型号" -#: assets/serializers/asset/host.py:15 +#: assets/serializers/asset/info/gathered.py:10 msgid "CPU count" msgstr "CPU数量" -#: assets/serializers/asset/host.py:16 +#: assets/serializers/asset/info/gathered.py:11 msgid "CPU cores" msgstr "CPU核数" -#: assets/serializers/asset/host.py:17 +#: assets/serializers/asset/info/gathered.py:12 msgid "CPU vcpus" msgstr "CPU总数" -#: assets/serializers/asset/host.py:18 +#: assets/serializers/asset/info/gathered.py:13 msgid "Memory" msgstr "内存" -#: assets/serializers/asset/host.py:19 +#: assets/serializers/asset/info/gathered.py:14 msgid "Disk total" msgstr "硬盘大小" -#: assets/serializers/asset/host.py:21 -#: authentication/serializers/connect_token_secret.py:103 +#: assets/serializers/asset/info/gathered.py:16 +#: authentication/serializers/connect_token_secret.py:104 msgid "OS" msgstr "操作系统" -#: assets/serializers/asset/host.py:22 +#: assets/serializers/asset/info/gathered.py:17 msgid "OS version" msgstr "系统版本" -#: assets/serializers/asset/host.py:23 +#: assets/serializers/asset/info/gathered.py:18 msgid "OS arch" msgstr "系统架构" -#: assets/serializers/asset/host.py:27 -msgid "Info" -msgstr "信息" - #: assets/serializers/cagegory.py:9 msgid "Constraints" msgstr "约束" @@ -1684,7 +1691,7 @@ msgstr "约束" msgid "Types" msgstr "类型" -#: assets/serializers/gateway.py:23 common/validators.py:32 +#: assets/serializers/gateway.py:23 common/validators.py:35 msgid "This field must be unique." msgstr "字段必须唯一" @@ -1716,23 +1723,37 @@ msgstr "SFTP 根路径" msgid "Auth with username" msgstr "使用用户名认证" -#: assets/serializers/platform.py:70 +#: assets/serializers/platform.py:73 msgid "Gather accounts enabled" msgstr "启用账号收集" -#: assets/serializers/platform.py:71 +#: assets/serializers/platform.py:74 msgid "Gather accounts method" msgstr "收集账号方式" -#: assets/serializers/platform.py:134 +#: assets/serializers/platform.py:103 +#, fuzzy +#| msgid "Help" +msgid "Help text" +msgstr "帮助" + +#: assets/serializers/platform.py:104 +msgid "Choices" +msgstr "" + +#: assets/serializers/platform.py:119 +msgid "Automation" +msgstr "自动化" + +#: assets/serializers/platform.py:143 msgid "Default Domain" msgstr "默认网域" -#: assets/serializers/platform.py:143 +#: assets/serializers/platform.py:152 msgid "type is required" msgstr "类型 该字段是必填项。" -#: assets/serializers/platform.py:173 +#: assets/serializers/platform.py:189 msgid "Protocols is required" msgstr "协议是必填的" @@ -1869,7 +1890,7 @@ msgid "Change password" msgstr "改密" #: audits/const.py:34 settings/serializers/terminal.py:6 -#: terminal/models/applet/host.py:25 terminal/models/component/terminal.py:163 +#: terminal/models/applet/host.py:25 terminal/models/component/terminal.py:162 #: terminal/serializers/session.py:48 msgid "Terminal" msgstr "终端" @@ -1983,7 +2004,7 @@ msgstr "用户代理" #: audits/models.py:169 audits/serializers.py:47 #: authentication/templates/authentication/_mfa_confirm_modal.html:14 #: users/forms/profile.py:65 users/models/user.py:740 -#: users/serializers/profile.py:124 +#: users/serializers/profile.py:126 msgid "MFA" msgstr "MFA" @@ -2068,19 +2089,19 @@ msgstr "清理审计会话任务日志" msgid "This action require verify your MFA" msgstr "该操作需要验证您的 MFA, 请先开启并配置" -#: authentication/api/connection_token.py:295 +#: authentication/api/connection_token.py:296 msgid "Account not found" msgstr "账号未找到" -#: authentication/api/connection_token.py:298 +#: authentication/api/connection_token.py:299 msgid "Permission expired" msgstr "授权已过期" -#: authentication/api/connection_token.py:310 +#: authentication/api/connection_token.py:311 msgid "ACL action is reject" msgstr "ACL 动作是拒绝" -#: authentication/api/connection_token.py:314 +#: authentication/api/connection_token.py:315 msgid "ACL action is review" msgstr "ACL 动作是复核" @@ -2441,70 +2462,70 @@ msgstr "该 MFA ({}) 方式没有启用" msgid "Please change your password" msgstr "请修改密码" -#: authentication/models/connection_token.py:35 +#: authentication/models/connection_token.py:36 #: terminal/serializers/storage.py:111 msgid "Account name" msgstr "账号名称" -#: authentication/models/connection_token.py:36 +#: authentication/models/connection_token.py:37 msgid "Input username" msgstr "自定义用户名" -#: authentication/models/connection_token.py:37 +#: authentication/models/connection_token.py:38 #: authentication/serializers/connection_token.py:17 msgid "Input secret" msgstr "自定义密码" -#: authentication/models/connection_token.py:39 +#: authentication/models/connection_token.py:40 msgid "Connect method" msgstr "连接方式" -#: authentication/models/connection_token.py:40 +#: authentication/models/connection_token.py:41 #: rbac/serializers/rolebinding.py:21 msgid "User display" msgstr "用户名称" -#: authentication/models/connection_token.py:41 +#: authentication/models/connection_token.py:42 msgid "Asset display" msgstr "资产名称" -#: authentication/models/connection_token.py:42 +#: authentication/models/connection_token.py:43 #: authentication/models/temp_token.py:13 perms/models/asset_permission.py:74 #: tickets/models/ticket/apply_application.py:31 #: tickets/models/ticket/apply_asset.py:20 users/models/user.py:761 msgid "Date expired" msgstr "失效日期" -#: authentication/models/connection_token.py:46 +#: authentication/models/connection_token.py:47 #: perms/models/asset_permission.py:77 msgid "From ticket" msgstr "来自工单" -#: authentication/models/connection_token.py:52 +#: authentication/models/connection_token.py:53 msgid "Connection token" msgstr "连接令牌" -#: authentication/models/connection_token.py:54 +#: authentication/models/connection_token.py:55 msgid "Can view connection token secret" msgstr "可以查看连接令牌密文" -#: authentication/models/connection_token.py:101 +#: authentication/models/connection_token.py:102 msgid "Connection token inactive" msgstr "连接令牌未激活" -#: authentication/models/connection_token.py:104 +#: authentication/models/connection_token.py:105 msgid "Connection token expired at: {}" msgstr "连接令牌过期: {}" -#: authentication/models/connection_token.py:107 +#: authentication/models/connection_token.py:108 msgid "No user or invalid user" msgstr "没有用户或用户失效" -#: authentication/models/connection_token.py:111 +#: authentication/models/connection_token.py:112 msgid "No asset or inactive asset" msgstr "没有资产或资产未激活" -#: authentication/models/connection_token.py:258 +#: authentication/models/connection_token.py:261 msgid "Super connection token" msgstr "超级连接令牌" @@ -2532,23 +2553,23 @@ msgstr "异地登录提醒" msgid "binding reminder" msgstr "绑定提醒" -#: authentication/serializers/connect_token_secret.py:104 +#: authentication/serializers/connect_token_secret.py:105 msgid "Is builtin" msgstr "内置的" -#: authentication/serializers/connect_token_secret.py:108 +#: authentication/serializers/connect_token_secret.py:109 msgid "Options" msgstr "选项" -#: authentication/serializers/connect_token_secret.py:115 +#: authentication/serializers/connect_token_secret.py:116 msgid "Component" msgstr "组件" -#: authentication/serializers/connect_token_secret.py:126 +#: authentication/serializers/connect_token_secret.py:127 msgid "Expired now" msgstr "立刻过期" -#: authentication/serializers/connect_token_secret.py:145 +#: authentication/serializers/connect_token_secret.py:146 #: authentication/templates/authentication/_access_key_modal.html:30 #: perms/models/perm_node.py:21 users/serializers/group.py:33 msgid "ID" @@ -2572,7 +2593,7 @@ msgstr "动作" #: authentication/serializers/connection_token.py:41 #: perms/serializers/permission.py:38 perms/serializers/permission.py:70 -#: users/serializers/user.py:93 users/serializers/user.py:165 +#: users/serializers/user.py:97 users/serializers/user.py:172 msgid "Is expired" msgstr "已过期" @@ -2592,8 +2613,8 @@ msgid "The {} cannot be empty" msgstr "{} 不能为空" #: authentication/serializers/token.py:79 perms/serializers/permission.py:37 -#: perms/serializers/permission.py:71 users/serializers/user.py:94 -#: users/serializers/user.py:163 +#: perms/serializers/permission.py:71 users/serializers/user.py:98 +#: users/serializers/user.py:170 msgid "Is valid" msgstr "是否有效" @@ -2619,13 +2640,13 @@ msgstr "显示" #: authentication/templates/authentication/_access_key_modal.html:66 #: settings/serializers/security.py:39 users/models/user.py:601 -#: users/serializers/profile.py:115 +#: users/serializers/profile.py:116 #: users/templates/users/user_verify_mfa.html:36 msgid "Disable" msgstr "禁用" #: authentication/templates/authentication/_access_key_modal.html:67 -#: users/models/user.py:602 users/serializers/profile.py:116 +#: users/models/user.py:602 users/serializers/profile.py:117 #: users/templates/users/mfa_setting.html:26 #: users/templates/users/mfa_setting.html:68 msgid "Enable" @@ -2977,12 +2998,12 @@ msgstr "运行中" msgid "Canceled" msgstr "取消" -#: common/const/common.py:3 +#: common/const/common.py:5 #, python-format msgid "%(name)s was created successfully" msgstr "%(name)s 创建成功" -#: common/const/common.py:4 +#: common/const/common.py:6 #, python-format msgid "%(name)s was updated successfully" msgstr "%(name)s 更新成功" @@ -3148,29 +3169,29 @@ msgstr "验证码错误" msgid "Please wait {} seconds before sending" msgstr "请在 {} 秒后发送" -#: common/serializers/common.py:84 +#: common/serializers/common.py:90 msgid "Children" msgstr "节点" -#: common/serializers/common.py:92 +#: common/serializers/common.py:98 msgid "File" msgstr "文件" -#: common/serializers/fields.py:101 +#: common/serializers/fields.py:103 #, python-brace-format msgid "Invalid pk \"{pk_value}\" - object does not exist." msgstr "错误的 pk \"{pk_value}\" - 对象不存在" -#: common/serializers/fields.py:102 +#: common/serializers/fields.py:104 #, python-brace-format msgid "Incorrect type. Expected pk value, received {data_type}." msgstr "错误类型。期望 pk 值,收到 {data_type}。" -#: common/serializers/fields.py:172 +#: common/serializers/fields.py:174 msgid "Invalid data type, should be list" msgstr "错误的数据类型,应该是列表" -#: common/serializers/fields.py:187 +#: common/serializers/fields.py:189 msgid "Invalid choice: {}" msgstr "无效选项: {}" @@ -3195,15 +3216,15 @@ msgstr "无效地址" msgid "Hello %s" msgstr "你好 %s" -#: common/validators.py:14 +#: common/validators.py:17 msgid "Special char not allowed" msgstr "不能包含特殊字符" -#: common/validators.py:40 +#: common/validators.py:43 msgid "Should not contains special characters" msgstr "不能包含特殊字符" -#: common/validators.py:46 +#: common/validators.py:48 msgid "The mobile phone number format is incorrect" msgstr "手机号格式不正确" @@ -3296,11 +3317,11 @@ msgstr "发布站内消息" msgid "No account available" msgstr "无可用账号" -#: ops/ansible/inventory.py:209 +#: ops/ansible/inventory.py:236 msgid "Ansible disabled" msgstr "Ansible 已禁用" -#: ops/ansible/inventory.py:225 +#: ops/ansible/inventory.py:252 msgid "Skip hosts below:" msgstr "跳过以下主机: " @@ -3324,7 +3345,7 @@ msgstr "当前 playbook 正在作业中使用" msgid "Unsupported file content" msgstr "不支持的文件内容" -#: ops/apps.py:9 ops/notifications.py:16 rbac/tree.py:55 +#: ops/apps.py:9 ops/notifications.py:17 rbac/tree.py:55 msgid "App ops" msgstr "作业中心" @@ -3364,7 +3385,7 @@ msgstr "VCS" msgid "Adhoc" msgstr "命令" -#: ops/const.py:39 ops/models/job.py:100 +#: ops/const.py:39 ops/models/job.py:101 msgid "Playbook" msgstr "Playbook" @@ -3421,17 +3442,17 @@ msgstr "需要周期或定期设置" msgid "Pattern" msgstr "模式" -#: ops/models/adhoc.py:24 ops/models/job.py:95 +#: ops/models/adhoc.py:24 ops/models/job.py:96 msgid "Module" msgstr "模块" -#: ops/models/adhoc.py:25 ops/models/celery.py:58 ops/models/job.py:94 +#: ops/models/adhoc.py:25 ops/models/celery.py:58 ops/models/job.py:95 #: terminal/models/component/task.py:16 msgid "Args" msgstr "参数" #: ops/models/adhoc.py:26 ops/models/base.py:16 ops/models/base.py:53 -#: ops/models/job.py:103 ops/models/job.py:189 ops/models/playbook.py:25 +#: ops/models/job.py:104 ops/models/job.py:190 ops/models/playbook.py:25 #: terminal/models/session/sharing.py:23 msgid "Creator" msgstr "创建者" @@ -3444,16 +3465,16 @@ msgstr "账号策略" msgid "Last execution" msgstr "最后执行" -#: ops/models/base.py:22 ops/serializers/job.py:18 +#: ops/models/base.py:22 ops/serializers/job.py:19 msgid "Date last run" msgstr "最后运行日期" -#: ops/models/base.py:51 ops/models/job.py:187 +#: ops/models/base.py:51 ops/models/job.py:188 #: xpack/plugins/cloud/models.py:162 msgid "Result" msgstr "结果" -#: ops/models/base.py:52 ops/models/job.py:188 +#: ops/models/base.py:52 ops/models/job.py:189 msgid "Summary" msgstr "汇总" @@ -3486,47 +3507,43 @@ msgstr "发布日期" msgid "Celery Task Execution" msgstr "Celery 任务执行" -#: ops/models/job.py:97 +#: ops/models/job.py:98 msgid "Chdir" msgstr "运行目录" -#: ops/models/job.py:98 +#: ops/models/job.py:99 msgid "Timeout (Seconds)" msgstr "超时时间(秒)" -#: ops/models/job.py:105 +#: ops/models/job.py:106 msgid "Use Parameter Define" msgstr "使用参数定义" -#: ops/models/job.py:106 +#: ops/models/job.py:107 msgid "Parameters define" msgstr "参数定义" -#: ops/models/job.py:107 +#: ops/models/job.py:108 msgid "Runas" msgstr "运行用户" -#: ops/models/job.py:109 +#: ops/models/job.py:110 msgid "Runas policy" msgstr "用户策略" -#: ops/models/job.py:171 +#: ops/models/job.py:172 msgid "Job" msgstr "作业" -#: ops/models/job.py:186 -msgid "Parameters" -msgstr "参数" - -#: ops/models/job.py:194 +#: ops/models/job.py:195 msgid "Material" msgstr "" -#: ops/models/job.py:196 +#: ops/models/job.py:197 msgid "Material Type" msgstr "" -#: ops/models/job.py:455 +#: ops/models/job.py:456 msgid "Job Execution" msgstr "作业执行" @@ -3538,47 +3555,47 @@ msgstr "创建方式" msgid "VCS URL" msgstr "" -#: ops/notifications.py:17 +#: ops/notifications.py:18 msgid "Server performance" msgstr "监控告警" -#: ops/notifications.py:23 +#: ops/notifications.py:24 msgid "Terminal health check warning" msgstr "终端健康状况检查警告" -#: ops/notifications.py:68 +#: ops/notifications.py:69 #, python-brace-format msgid "The terminal is offline: {name}" msgstr "终端已离线: {name}" -#: ops/notifications.py:73 +#: ops/notifications.py:74 #, python-brace-format msgid "Disk used more than {max_threshold}%: => {value}" msgstr "硬盘使用率超过 {max_threshold}%: => {value}" -#: ops/notifications.py:78 +#: ops/notifications.py:79 #, python-brace-format msgid "Memory used more than {max_threshold}%: => {value}" msgstr "内存使用率超过 {max_threshold}%: => {value}" -#: ops/notifications.py:83 +#: ops/notifications.py:84 #, python-brace-format msgid "CPU load more than {max_threshold}: => {value}" msgstr "CPU 使用率超过 {max_threshold}: => {value}" -#: ops/serializers/job.py:16 +#: ops/serializers/job.py:17 msgid "Run after save" msgstr "保存后执行" -#: ops/serializers/job.py:64 +#: ops/serializers/job.py:70 msgid "Job type" msgstr "任务类型" -#: ops/serializers/job.py:67 terminal/serializers/session.py:49 +#: ops/serializers/job.py:73 terminal/serializers/session.py:49 msgid "Is finished" msgstr "是否完成" -#: ops/serializers/job.py:68 +#: ops/serializers/job.py:74 msgid "Time cost" msgstr "花费时间" @@ -3675,7 +3692,7 @@ msgstr "组织" msgid "Org name" msgstr "组织名称" -#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:33 +#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:32 msgid "Builtin" msgstr "内置的" @@ -3911,7 +3928,7 @@ msgstr "组织角色绑定" msgid "System role binding" msgstr "系统角色绑定" -#: rbac/serializers/permission.py:26 users/serializers/profile.py:130 +#: rbac/serializers/permission.py:26 users/serializers/profile.py:132 msgid "Perms" msgstr "权限" @@ -3919,7 +3936,7 @@ msgstr "权限" msgid "Users amount" msgstr "用户数量" -#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:28 +#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:27 msgid "Display name" msgstr "显示名称" @@ -3983,8 +4000,8 @@ msgstr "任务中心" msgid "My assets" msgstr "我的资产" -#: rbac/tree.py:56 terminal/models/applet/applet.py:43 -#: terminal/models/applet/applet.py:156 terminal/models/applet/host.py:28 +#: rbac/tree.py:56 terminal/models/applet/applet.py:42 +#: terminal/models/applet/applet.py:179 terminal/models/applet/host.py:28 #: terminal/serializers/applet.py:15 msgid "Applet" msgstr "远程应用" @@ -4482,7 +4499,7 @@ msgid "SSO auth key TTL" msgstr "令牌有效期" #: settings/serializers/auth/sso.py:17 -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:194 msgid "Unit: second" msgstr "单位: 秒" @@ -5483,23 +5500,35 @@ msgstr "不支持批量创建" msgid "Storage is invalid" msgstr "存储无效" -#: terminal/models/applet/applet.py:30 +#: terminal/models/applet/applet.py:29 msgid "Author" msgstr "作者" -#: terminal/models/applet/applet.py:35 +#: terminal/models/applet/applet.py:34 msgid "Tags" msgstr "标签" -#: terminal/models/applet/applet.py:39 terminal/serializers/storage.py:157 +#: terminal/models/applet/applet.py:38 terminal/serializers/storage.py:157 msgid "Hosts" msgstr "主机" -#: terminal/models/applet/applet.py:84 +#: terminal/models/applet/applet.py:83 msgid "Applet pkg not valid, Missing file {}" msgstr "Applet pkg 无效,缺少文件 {}" -#: terminal/models/applet/applet.py:158 terminal/models/applet/host.py:34 +#: terminal/models/applet/applet.py:102 +msgid "Load platform.yml failed: {}" +msgstr "" + +#: terminal/models/applet/applet.py:105 +msgid "Only support custom platform" +msgstr "" + +#: terminal/models/applet/applet.py:110 +msgid "Missing type in platform.yml" +msgstr "" + +#: terminal/models/applet/applet.py:181 terminal/models/applet/host.py:34 #: terminal/models/applet/host.py:106 msgid "Hosting" msgstr "宿主机" @@ -5605,28 +5634,28 @@ msgid "Default storage" msgstr "默认存储" #: terminal/models/component/storage.py:140 -#: terminal/models/component/terminal.py:91 +#: terminal/models/component/terminal.py:90 msgid "Command storage" msgstr "命令存储" #: terminal/models/component/storage.py:200 -#: terminal/models/component/terminal.py:92 +#: terminal/models/component/terminal.py:91 msgid "Replay storage" msgstr "录像存储" -#: terminal/models/component/terminal.py:88 +#: terminal/models/component/terminal.py:87 msgid "type" msgstr "类型" -#: terminal/models/component/terminal.py:90 terminal/serializers/command.py:51 +#: terminal/models/component/terminal.py:89 terminal/serializers/command.py:51 msgid "Remote Address" msgstr "远端地址" -#: terminal/models/component/terminal.py:93 +#: terminal/models/component/terminal.py:92 msgid "Application User" msgstr "应用用户" -#: terminal/models/component/terminal.py:165 +#: terminal/models/component/terminal.py:164 msgid "Can view terminal config" msgstr "可以查看终端配置" @@ -6429,8 +6458,8 @@ msgstr "复制你的公钥到这里" msgid "Public key should not be the same as your old one." msgstr "不能和原来的密钥相同" -#: users/forms/profile.py:159 users/serializers/profile.py:99 -#: users/serializers/profile.py:181 users/serializers/profile.py:208 +#: users/forms/profile.py:159 users/serializers/profile.py:100 +#: users/serializers/profile.py:183 users/serializers/profile.py:210 msgid "Not a valid ssh public key" msgstr "SSH密钥不合法" @@ -6438,11 +6467,11 @@ msgstr "SSH密钥不合法" msgid "Public key" msgstr "SSH公钥" -#: users/models/user.py:603 +#: users/models/user.py:603 users/serializers/profile.py:118 msgid "Force enable" msgstr "强制启用" -#: users/models/user.py:729 users/serializers/user.py:164 +#: users/models/user.py:729 users/serializers/user.py:171 msgid "Is service account" msgstr "服务账号" @@ -6454,7 +6483,7 @@ msgstr "头像" msgid "Wechat" msgstr "微信" -#: users/models/user.py:737 +#: users/models/user.py:737 users/serializers/user.py:109 msgid "Phone" msgstr "手机" @@ -6470,8 +6499,8 @@ msgstr "ssh私钥" msgid "Secret key" msgstr "Secret key" -#: users/models/user.py:758 users/serializers/profile.py:147 -#: users/serializers/user.py:161 +#: users/models/user.py:758 users/serializers/profile.py:149 +#: users/serializers/user.py:168 msgid "Is first login" msgstr "首次登录" @@ -6542,7 +6571,7 @@ msgstr "重置 MFA" msgid "The old password is incorrect" msgstr "旧密码错误" -#: users/serializers/profile.py:36 users/serializers/profile.py:195 +#: users/serializers/profile.py:36 users/serializers/profile.py:197 msgid "Password does not match security rules" msgstr "密码不满足安全规则" @@ -6550,59 +6579,59 @@ msgstr "密码不满足安全规则" msgid "The new password cannot be the last {} passwords" msgstr "新密码不能是最近 {} 次的密码" -#: users/serializers/profile.py:48 users/serializers/profile.py:70 +#: users/serializers/profile.py:48 users/serializers/profile.py:71 msgid "The newly set password is inconsistent" msgstr "两次密码不一致" -#: users/serializers/user.py:39 +#: users/serializers/user.py:43 msgid "System roles" msgstr "系统角色" -#: users/serializers/user.py:43 +#: users/serializers/user.py:47 msgid "Org roles" msgstr "组织角色" -#: users/serializers/user.py:86 +#: users/serializers/user.py:90 msgid "Password strategy" msgstr "密码策略" -#: users/serializers/user.py:88 +#: users/serializers/user.py:92 msgid "MFA enabled" msgstr "MFA 已启用" -#: users/serializers/user.py:90 +#: users/serializers/user.py:94 msgid "MFA force enabled" msgstr "强制 MFA" -#: users/serializers/user.py:92 +#: users/serializers/user.py:96 msgid "Login blocked" msgstr "登录被锁定" -#: users/serializers/user.py:95 users/serializers/user.py:169 +#: users/serializers/user.py:99 users/serializers/user.py:176 msgid "Is OTP bound" msgstr "是否绑定了虚拟 MFA" -#: users/serializers/user.py:97 +#: users/serializers/user.py:101 msgid "Can public key authentication" msgstr "可以使用公钥认证" -#: users/serializers/user.py:166 +#: users/serializers/user.py:173 msgid "Avatar url" msgstr "头像路径" -#: users/serializers/user.py:171 +#: users/serializers/user.py:177 msgid "MFA level" msgstr "MFA 级别" -#: users/serializers/user.py:277 +#: users/serializers/user.py:283 msgid "Select users" msgstr "选择用户" -#: users/serializers/user.py:278 +#: users/serializers/user.py:284 msgid "For security, only list several users" msgstr "为了安全,仅列出几个用户" -#: users/serializers/user.py:311 +#: users/serializers/user.py:317 msgid "name not unique" msgstr "名称重复" @@ -7309,13 +7338,13 @@ msgstr "JSON 格式的文件" msgid "IP address invalid `{}`, {}" msgstr "IP 地址无效: `{}`, {}" -#: xpack/plugins/cloud/serializers/account_attrs.py:162 +#: xpack/plugins/cloud/serializers/account_attrs.py:172 msgid "" "Format for comma-delimited string,Such as: 192.168.1.0/24, " "10.0.0.0-10.0.0.255" msgstr "格式为逗号分隔的字符串,如:192.168.1.0/24,10.0.0.0-10.0.0.255" -#: xpack/plugins/cloud/serializers/account_attrs.py:166 +#: xpack/plugins/cloud/serializers/account_attrs.py:176 msgid "" "The port is used to detect the validity of the IP address. When the " "synchronization task is executed, only the valid IP address will be " @@ -7324,19 +7353,19 @@ msgstr "" "端口用来检测 IP 地址的有效性,在同步任务执行时,只会同步有效的 IP 地址。
" "如果端口为 0,则表示所有 IP 地址均有效。" -#: xpack/plugins/cloud/serializers/account_attrs.py:174 +#: xpack/plugins/cloud/serializers/account_attrs.py:184 msgid "Hostname prefix" msgstr "主机名前缀" -#: xpack/plugins/cloud/serializers/account_attrs.py:177 +#: xpack/plugins/cloud/serializers/account_attrs.py:187 msgid "IP segment" msgstr "IP 网段" -#: xpack/plugins/cloud/serializers/account_attrs.py:181 +#: xpack/plugins/cloud/serializers/account_attrs.py:191 msgid "Test port" msgstr "测试端口" -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:194 msgid "Test timeout" msgstr "测试超时时间" @@ -7416,26 +7445,32 @@ msgstr "许可证导入成功" msgid "License is invalid" msgstr "无效的许可证" -#: xpack/plugins/license/meta.py:11 xpack/plugins/license/models.py:135 +#: xpack/plugins/license/meta.py:11 xpack/plugins/license/models.py:138 msgid "License" msgstr "许可证" -#: xpack/plugins/license/models.py:79 +#: xpack/plugins/license/models.py:80 msgid "Standard edition" msgstr "标准版" -#: xpack/plugins/license/models.py:81 +#: xpack/plugins/license/models.py:82 msgid "Enterprise edition" msgstr "企业版" -#: xpack/plugins/license/models.py:83 +#: xpack/plugins/license/models.py:84 msgid "Ultimate edition" msgstr "旗舰版" -#: xpack/plugins/license/models.py:85 +#: xpack/plugins/license/models.py:86 msgid "Community edition" msgstr "社区版" +#~ msgid "Auto fill" +#~ msgstr "自动代填" + +#~ msgid "Info" +#~ msgstr "信息" + #, fuzzy #~| msgid "Custom user" #~ msgid "Custom" From 3afab38c5fb07bfea2a1c7352a1c52d2f060b439 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 19 Apr 2023 13:21:57 +0800 Subject: [PATCH 30/48] =?UTF-8?q?perf:=20=E8=B5=84=E4=BA=A7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=8E=92=E5=BA=8F=20(#10258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/assets/api/asset/asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/assets/api/asset/asset.py b/apps/assets/api/asset/asset.py index aa20bded9..d7321aef8 100644 --- a/apps/assets/api/asset/asset.py +++ b/apps/assets/api/asset/asset.py @@ -96,7 +96,7 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet): model = Asset filterset_class = AssetFilterSet search_fields = ("name", "address") - ordering = ("name", "connectivity") + ordering_fields = ('name', 'connectivity', 'platform') serializer_classes = ( ("default", serializers.AssetSerializer), ("platform", serializers.PlatformSerializer), From 96eb87f9356b85da8c57be2281c66a56d67f926f Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 19 Apr 2023 14:13:13 +0800 Subject: [PATCH 31/48] =?UTF-8?q?feat:=20=E6=9C=8D=E5=8A=A1=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E6=A0=A1=E9=AA=8C=20migrations=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=98=AF=E5=90=A6=E6=9C=89=E5=86=B2=E7=AA=81(DEBUG=5F?= =?UTF-8?q?DEV)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/signal_handlers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/common/signal_handlers.py b/apps/common/signal_handlers.py index 752682c51..b7acf6e79 100644 --- a/apps/common/signal_handlers.py +++ b/apps/common/signal_handlers.py @@ -134,7 +134,7 @@ def check_migrations_file_prefix_conflict(*args, **kwargs): return from jumpserver.const import BASE_DIR - print('>>> Check migrations file prefix conflict') + print('>>> Check migrations file prefix conflict.', end=' ') # 指定 app 目录 _dir = BASE_DIR # 获取所有子目录 @@ -167,8 +167,12 @@ def check_migrations_file_prefix_conflict(*args, **kwargs): else: prefix_file_map[file_prefix] = file + conflict_count = len(conflict_files) + print(f'Conflict count:({conflict_count})') + if not conflict_count: + return + print('='*80) - print(f'Conflict count:({len(conflict_files)})') for conflict_file in conflict_files: msg_dir = '{:<15}'.format(conflict_file[0]) msg_split = '=> ' From 2ba32f6971eaa07fd1cb64811d716575163a0428 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Wed, 19 Apr 2023 14:44:06 +0800 Subject: [PATCH 32/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=94=B9=E5=AF=86=E6=97=B6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=9C=A8=E5=91=BD=E4=BB=A4=E4=B8=AD=E5=8C=85=E5=90=ABssh?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E7=9A=84=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accounts/automations/change_secret/custom/ssh/manifest.yml | 2 +- apps/ops/ansible/modules/custom_command.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/accounts/automations/change_secret/custom/ssh/manifest.yml b/apps/accounts/automations/change_secret/custom/ssh/manifest.yml index 2796c32c4..465cfa1e2 100644 --- a/apps/accounts/automations/change_secret/custom/ssh/manifest.yml +++ b/apps/accounts/automations/change_secret/custom/ssh/manifest.yml @@ -11,4 +11,4 @@ params: type: list label: '自定义命令' default: [''] - help_text: '自定义命令中如需包含账号的 username 和 password 字段,请使用 {username}、{password}格式,执行任务时会进行替换 。
比如针对 Linux 主机进行改密,一般需要配置三条命令:
1.passwd {username}
2.{password}
3.{password}' + help_text: '自定义命令中如需包含账号的 账号、密码、SSH 连接的用户密码 字段,
请使用 {username}、{password}、{login_password}格式,执行任务时会进行替换 。
比如针对 Cisco 主机进行改密,一般需要配置五条命令:
1. enable
2. {login_password}
3. configure terminal
4. username {username} privilege 0 password {password}
5. end' diff --git a/apps/ops/ansible/modules/custom_command.py b/apps/ops/ansible/modules/custom_command.py index 4205e7088..4edff4324 100644 --- a/apps/ops/ansible/modules/custom_command.py +++ b/apps/ops/ansible/modules/custom_command.py @@ -72,9 +72,10 @@ def get_commands(module): username = module.params['name'] password = module.params['password'] commands = module.params['commands'] or [] + login_password = module.params['login_password'] for index, command in enumerate(commands): commands[index] = command.format( - username=username, password=password + username=username, password=password, login_password=login_password ) return commands From 11ad6ab273417be5e41e2d1d4810aa70b21beffd Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 10:33:53 +0800 Subject: [PATCH 33/48] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E4=B8=AD=E5=BF=83=E6=9C=AA=E5=BC=80=E5=90=AF=E7=9A=84?= =?UTF-8?q?acl=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#10265)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复作业中心未开启的acl生效的问题 * perf: 优化代码风格 --------- Co-authored-by: Aaron3S --- apps/ops/models/job.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index a49885dff..193debe31 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -402,9 +402,11 @@ class JobExecution(JMSOrgBaseModel): def check_command_acl(self): for asset in self.current_job.assets.all(): - acls = CommandFilterACL.filter_queryset(user=self.creator, - asset=asset, - account_username=self.current_job.runas) + acls = CommandFilterACL.filter_queryset( + user=self.creator, + asset=asset, + is_active=True, + account_username=self.current_job.runas) for acl in acls: if self.match_command_group(acl, asset): break From 6b3665e8d01fc4efd26c55c9e4efd1cc88e4c131 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 11:13:28 +0800 Subject: [PATCH 34/48] =?UTF-8?q?perf:=20yaml=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/mysql/manifest.yml | 10 +++++- apps/assets/automations/methods.py | 5 +-- .../automations/ping/host/posix/manifest.yml | 10 +++++- apps/common/utils/yml.py | 34 +++++++++++++++++++ apps/terminal/applets/chrome/i18n.yml | 4 --- apps/terminal/applets/chrome/manifest.yml | 15 ++++++-- apps/terminal/applets/dbeaver/manifest.yml | 15 ++++++-- apps/terminal/models/applet/applet.py | 5 +-- 8 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 apps/common/utils/yml.py delete mode 100644 apps/terminal/applets/chrome/i18n.yml diff --git a/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml b/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml index be104b783..22f57156c 100644 --- a/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml +++ b/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml @@ -1,7 +1,15 @@ id: gather_accounts_mysql -name: Gather account from MySQL +name: "{{ 'Gather account from MySQL' | trans }}" category: database type: - mysql - mariadb method: gather_accounts + +i18n: + en: + Gather account from MySQL: Gather account from MySQL + zh: + Gather account from MySQL: 从MySQL获取账号 + ja: + Gather account from MySQL: MySQLからアカウントを取得する diff --git a/apps/assets/automations/methods.py b/apps/assets/automations/methods.py index cad2b1b3c..5b80bb547 100644 --- a/apps/assets/automations/methods.py +++ b/apps/assets/automations/methods.py @@ -2,7 +2,7 @@ import json import os from functools import partial -import yaml +from common.utils.yml import yaml_load_with_i18n def check_platform_method(manifest, manifest_path): @@ -40,7 +40,8 @@ def get_platform_automation_methods(path): continue with open(path, 'r') as f: - manifest = yaml.safe_load(f) + print("path: ", path) + manifest = yaml_load_with_i18n(f) check_platform_method(manifest, path) manifest['dir'] = os.path.dirname(path) manifest['params_serializer'] = generate_serializer(manifest) diff --git a/apps/assets/automations/ping/host/posix/manifest.yml b/apps/assets/automations/ping/host/posix/manifest.yml index 4b9afde37..7e00c99f9 100644 --- a/apps/assets/automations/ping/host/posix/manifest.yml +++ b/apps/assets/automations/ping/host/posix/manifest.yml @@ -1,7 +1,15 @@ id: posix_ping -name: Posix ping +name: "{{ 'Posix ping' | trans }}" category: host type: - linux - unix method: ping + +i18n: + zh: + Posix ping: Posix 测试 + ja: + Posix ping: Posix ピング + en: + Posix ping: Posix ping diff --git a/apps/common/utils/yml.py b/apps/common/utils/yml.py new file mode 100644 index 000000000..2a2954514 --- /dev/null +++ b/apps/common/utils/yml.py @@ -0,0 +1,34 @@ +import io + +import yaml +from django.utils.translation import get_language +from jinja2 import Environment + + +def translate(i18n, key): + lang = get_language()[:2] + lang_data = i18n.get(lang, {}) + return lang_data.get(key, key) + + +def yaml_load_with_i18n(stream): + ori_text = stream.read() + stream = io.StringIO(ori_text) + yaml_data = yaml.safe_load(stream) + i18n = yaml_data.get('i18n', {}) + + env = Environment() + env.filters['trans'] = lambda key: translate(i18n, key) + template = env.from_string(ori_text) + yaml_data = template.render() + yaml_f = io.StringIO(yaml_data) + d = yaml.safe_load(yaml_f) + if isinstance(d, dict): + d.pop('i18n', None) + return d + + +if __name__ == '__main__': + with open('manifest.yml') as f: + data = yaml_load_with_i18n(f) + print(data) diff --git a/apps/terminal/applets/chrome/i18n.yml b/apps/terminal/applets/chrome/i18n.yml deleted file mode 100644 index d91977ba6..000000000 --- a/apps/terminal/applets/chrome/i18n.yml +++ /dev/null @@ -1,4 +0,0 @@ -- zh: - display_name: Chrome 浏览器 - comment: 浏览器打开 URL 页面地址 - diff --git a/apps/terminal/applets/chrome/manifest.yml b/apps/terminal/applets/chrome/manifest.yml index 850ec3f08..3b192ffee 100644 --- a/apps/terminal/applets/chrome/manifest.yml +++ b/apps/terminal/applets/chrome/manifest.yml @@ -1,7 +1,7 @@ name: chrome -display_name: Chrome Browser +display_name: "{{ 'Chrome Browser' | trans }}" version: 0.2 -comment: Chrome Browser Open URL Page Address +comment: "{{ 'Chrome Browser Open URL Page Address' | trans }}" author: JumpServer Team exec_type: python update_policy: always @@ -10,3 +10,14 @@ tags: - web protocols: - http + +i18n: + en: + Chrome Browser: Chrome Browser + Chrome Browser Open URL Page Address: Chrome Browser Open URL Page Address + zh: + Chrome Browser: Chrome 浏览器 + Chrome Browser Open URL Page Address: Chrome 浏览器打开网页地址 + ja: + Chrome Browser: Chrome ブラウザ + Chrome Browser Open URL Page Address: Chrome ブラウザでウェブページを開く diff --git a/apps/terminal/applets/dbeaver/manifest.yml b/apps/terminal/applets/dbeaver/manifest.yml index c8d44af64..dbf3c6dc3 100644 --- a/apps/terminal/applets/dbeaver/manifest.yml +++ b/apps/terminal/applets/dbeaver/manifest.yml @@ -1,6 +1,6 @@ name: dbeaver -display_name: DBeaver Community -comment: Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. +display_name: "{{ 'DBeaver Community' | trans }}" +comment: "{{ 'Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.' | trans }}" version: 0.1 exec_type: python author: JumpServer Team @@ -14,3 +14,14 @@ protocols: - postgresql - sqlserver - oracle + +i18n: + en: + DBeaver Community: DBeaver Community + Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. + zh: + DBeaver Community: DBeaver 社区版 + Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: 免费的多平台数据库工具,供开发人员、数据库管理员、分析师和所有需要使用数据库的人使用。 + ja: + DBeaver Community: DBeaver コミュニティ + Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: 開発者、データベース管理者、分析家、およびデータベースを使用する必要があるすべての人のための無料のマルチプラットフォームデータベースツール。 diff --git a/apps/terminal/models/applet/applet.py b/apps/terminal/models/applet/applet.py index c6e938028..786bc35de 100644 --- a/apps/terminal/models/applet/applet.py +++ b/apps/terminal/models/applet/applet.py @@ -12,6 +12,7 @@ from rest_framework.serializers import ValidationError from common.db.models import JMSBaseModel from common.utils import lazyproperty, get_logger +from common.utils.yml import yaml_load_with_i18n logger = get_logger(__name__) @@ -76,14 +77,14 @@ class Applet(JMSBaseModel): @staticmethod def validate_pkg(d): - files = ['manifest.yml', 'icon.png', 'i18n.yml', 'setup.yml'] + files = ['manifest.yml', 'icon.png', 'setup.yml'] for name in files: path = os.path.join(d, name) if not os.path.exists(path): raise ValidationError({'error': _('Applet pkg not valid, Missing file {}').format(name)}) with open(os.path.join(d, 'manifest.yml')) as f: - manifest = yaml.safe_load(f) + manifest = yaml_load_with_i18n(f) if not manifest.get('name', ''): raise ValidationError({'error': 'Missing name in manifest.yml'}) From dc5f7a5c054beca85de8ebec4f7ef939ce57f039 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 11:14:23 +0800 Subject: [PATCH 35/48] =?UTF-8?q?fix:=20=E8=B5=84=E4=BA=A7=20=E5=85=8B?= =?UTF-8?q?=E9=9A=86=E6=9C=89=E5=88=87=E6=8D=A2=E8=87=B3=E7=9A=84=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7400=20(#10266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/common/serializers/fields.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/common/serializers/fields.py b/apps/common/serializers/fields.py index e8a350023..0b1e7040c 100644 --- a/apps/common/serializers/fields.py +++ b/apps/common/serializers/fields.py @@ -2,6 +2,7 @@ # import phonenumbers from django.core.exceptions import ObjectDoesNotExist +from django.db.models import Model from django.utils.translation import gettext_lazy as _ from rest_framework import serializers from rest_framework.fields import ChoiceField, empty @@ -118,11 +119,15 @@ class ObjectRelatedField(serializers.RelatedField): return data def to_internal_value(self, data): + queryset = self.get_queryset() + if isinstance(data, Model): + return queryset.get(pk=data.pk) + if not isinstance(data, dict): pk = data else: pk = data.get("id") or data.get("pk") or data.get(self.attrs[0]) - queryset = self.get_queryset() + try: if isinstance(data, bool): raise TypeError From f2d34de161756639bd0babc29f105973f9d802b2 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 11:27:10 +0800 Subject: [PATCH 36/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automations/ping/host/posix/manifest.yml | 10 ++++------ apps/common/utils/yml.py | 4 ++-- apps/terminal/applets/chrome/manifest.yml | 17 ++++++++--------- apps/terminal/applets/dbeaver/i18n.yml | 3 --- apps/terminal/applets/dbeaver/manifest.yml | 18 +++++++++--------- 5 files changed, 23 insertions(+), 29 deletions(-) delete mode 100644 apps/terminal/applets/dbeaver/i18n.yml diff --git a/apps/assets/automations/ping/host/posix/manifest.yml b/apps/assets/automations/ping/host/posix/manifest.yml index 7e00c99f9..1e6143480 100644 --- a/apps/assets/automations/ping/host/posix/manifest.yml +++ b/apps/assets/automations/ping/host/posix/manifest.yml @@ -7,9 +7,7 @@ type: method: ping i18n: - zh: - Posix ping: Posix 测试 - ja: - Posix ping: Posix ピング - en: - Posix ping: Posix ping + Posix ping: + zh: Posix ping + en: Posix ping + ja: Posix ピング diff --git a/apps/common/utils/yml.py b/apps/common/utils/yml.py index 2a2954514..540f1a31f 100644 --- a/apps/common/utils/yml.py +++ b/apps/common/utils/yml.py @@ -7,8 +7,8 @@ from jinja2 import Environment def translate(i18n, key): lang = get_language()[:2] - lang_data = i18n.get(lang, {}) - return lang_data.get(key, key) + lang_data = i18n.get(key, {}) + return lang_data.get(lang, key) def yaml_load_with_i18n(stream): diff --git a/apps/terminal/applets/chrome/manifest.yml b/apps/terminal/applets/chrome/manifest.yml index 3b192ffee..1662a0422 100644 --- a/apps/terminal/applets/chrome/manifest.yml +++ b/apps/terminal/applets/chrome/manifest.yml @@ -12,12 +12,11 @@ protocols: - http i18n: - en: - Chrome Browser: Chrome Browser - Chrome Browser Open URL Page Address: Chrome Browser Open URL Page Address - zh: - Chrome Browser: Chrome 浏览器 - Chrome Browser Open URL Page Address: Chrome 浏览器打开网页地址 - ja: - Chrome Browser: Chrome ブラウザ - Chrome Browser Open URL Page Address: Chrome ブラウザでウェブページを開く + Chrome Browser: + en: Chrome Browser + zh: Chrome 浏览器 + ja: Chrome ブラウザ + Chrome Browser Open URL Page Address: + en: Chrome Browser Open URL Page Address + zh: Chrome 浏览器打开网页地址 + ja: Chrome ブラウザでウェブページを開く diff --git a/apps/terminal/applets/dbeaver/i18n.yml b/apps/terminal/applets/dbeaver/i18n.yml deleted file mode 100644 index fec926496..000000000 --- a/apps/terminal/applets/dbeaver/i18n.yml +++ /dev/null @@ -1,3 +0,0 @@ -- zh: - display_name: DBeaver Community - comment: 免费的多平台数据库工具,供开发人员、数据库管理员、分析师和所有需要使用数据库的人使用。 diff --git a/apps/terminal/applets/dbeaver/manifest.yml b/apps/terminal/applets/dbeaver/manifest.yml index dbf3c6dc3..5b834cf99 100644 --- a/apps/terminal/applets/dbeaver/manifest.yml +++ b/apps/terminal/applets/dbeaver/manifest.yml @@ -16,12 +16,12 @@ protocols: - oracle i18n: - en: - DBeaver Community: DBeaver Community - Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. - zh: - DBeaver Community: DBeaver 社区版 - Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: 免费的多平台数据库工具,供开发人员、数据库管理员、分析师和所有需要使用数据库的人使用。 - ja: - DBeaver Community: DBeaver コミュニティ - Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: 開発者、データベース管理者、分析家、およびデータベースを使用する必要があるすべての人のための無料のマルチプラットフォームデータベースツール。 + DBeaver Community: + en: DBeaver Community + zh: DBeaver 社区版 + ja: DBeaver コミュニティ + + Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.: + en: Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. + zh: 免费的多平台数据库工具,供开发人员、数据库管理员、分析师和所有需要使用数据库的人使用。 + ja: 開発者、データベース管理者、分析家、およびデータベースを使用する必要があるすべての人のための無料のマルチプラットフォームデータベースツール。 From c9ee46c0fb2edc794c6d0d6efca7e79041738e3c Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 11:32:33 +0800 Subject: [PATCH 37/48] =?UTF-8?q?perf:=20windows=20=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E5=8F=AF=E8=BF=9E=E6=8E=A5=E6=80=A7=20ansible=20=E5=88=B7?= =?UTF-8?q?=E6=96=B0=20(#10268)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/automations/verify_account/host/windows/main.yml | 3 +++ apps/assets/automations/ping/host/windows/main.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/apps/accounts/automations/verify_account/host/windows/main.yml b/apps/accounts/automations/verify_account/host/windows/main.yml index 6e126f34d..a0a722eba 100644 --- a/apps/accounts/automations/verify_account/host/windows/main.yml +++ b/apps/accounts/automations/verify_account/host/windows/main.yml @@ -1,6 +1,9 @@ - hosts: windows gather_facts: no tasks: + - name: Refresh connection + ansible.builtin.meta: reset_connection + - name: Verify account ansible.windows.win_ping: vars: diff --git a/apps/assets/automations/ping/host/windows/main.yml b/apps/assets/automations/ping/host/windows/main.yml index d5af857a4..92d8164ad 100644 --- a/apps/assets/automations/ping/host/windows/main.yml +++ b/apps/assets/automations/ping/host/windows/main.yml @@ -1,5 +1,8 @@ - hosts: windows gather_facts: no tasks: + - name: Refresh connection + ansible.builtin.meta: reset_connection + - name: Windows ping ansible.builtin.win_ping: From 651c53a92c20f3fea52341b9eaf39582166e3a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=8F=E7=99=BD?= <296015668@qq.com> Date: Thu, 20 Apr 2023 11:38:50 +0800 Subject: [PATCH 38/48] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20loong64=20?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile.loong64 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.loong64 b/Dockerfile.loong64 index 629623a85..8fdb38705 100644 --- a/Dockerfile.loong64 +++ b/Dockerfile.loong64 @@ -76,8 +76,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \ && pip install --upgrade setuptools wheel \ && pip install https://download.jumpserver.org/pypi/simple/cryptography/cryptography-38.0.4-cp39-cp39-linux_loongarch64.whl \ && pip install https://download.jumpserver.org/pypi/simple/greenlet/greenlet-1.1.2-cp39-cp39-linux_loongarch64.whl \ - && pip install $(grep 'PyNaCl' requirements/requirements.txt) \ - && GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true pip install grpcio \ + && pip install https://download.jumpserver.org/pypi/simple/PyNaCl/PyNaCl-1.5.0-cp39-cp39-linux_loongarch64.whl \ + && pip install https://download.jumpserver.org/pypi/simple/grpcio/grpcio-1.54.0-cp39-cp39-linux_loongarch64.whl \ && pip install $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \ && pip install -r requirements/requirements.txt From f496f7d63529ab17249c5d9046627ef77aba5440 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 13:51:41 +0800 Subject: [PATCH 39/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E4=BB=BB=E5=8A=A1=E7=9A=84=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automations/gather_facts/database/mongodb/manifest.yml | 7 ++++++- .../automations/gather_facts/database/mysql/manifest.yml | 7 ++++++- .../automations/gather_facts/database/oracle/manifest.yml | 7 ++++++- .../gather_facts/database/postgresql/manifest.yml | 7 ++++++- .../automations/gather_facts/host/posix/manifest.yml | 7 ++++++- .../automations/gather_facts/host/windows/manifest.yml | 7 ++++++- apps/assets/automations/ping/database/mongodb/manifest.yml | 7 ++++++- apps/assets/automations/ping/database/mysql/manifest.yml | 7 ++++++- apps/assets/automations/ping/database/oracle/manifest.yml | 7 ++++++- .../automations/ping/database/postgresql/manifest.yml | 7 ++++++- .../automations/ping/database/sqlserver/manifest.yml | 7 ++++++- apps/assets/automations/ping/host/posix/manifest.yml | 2 +- apps/assets/automations/ping/host/windows/manifest.yml | 7 ++++++- 13 files changed, 73 insertions(+), 13 deletions(-) diff --git a/apps/assets/automations/gather_facts/database/mongodb/manifest.yml b/apps/assets/automations/gather_facts/database/mongodb/manifest.yml index 9b832e838..0f1a497b1 100644 --- a/apps/assets/automations/gather_facts/database/mongodb/manifest.yml +++ b/apps/assets/automations/gather_facts/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: gather_facts_mongodb -name: Gather facts from MongoDB +name: "{{ 'Gather facts from MongoDB' | trans }}" category: database type: - mongodb method: gather_facts +i18n: + Gather facts from MongoDB: + zh: 从 MongoDB 获取信息 + en: Gather facts from MongoDB + ja: MongoDBから事実を取得する diff --git a/apps/assets/automations/gather_facts/database/mysql/manifest.yml b/apps/assets/automations/gather_facts/database/mysql/manifest.yml index 7149e96e9..d2f005859 100644 --- a/apps/assets/automations/gather_facts/database/mysql/manifest.yml +++ b/apps/assets/automations/gather_facts/database/mysql/manifest.yml @@ -1,7 +1,12 @@ id: gather_facts_mysql -name: Gather facts from MySQL +name: "{{ 'Gather facts from MySQL' | trans }}" category: database type: - mysql - mariadb method: gather_facts +i18n: + Gather facts from MySQL: + zh: 从 MySQL 获取信息 + en: Gather facts from MySQL + ja: MySQLから事実を取得する diff --git a/apps/assets/automations/gather_facts/database/oracle/manifest.yml b/apps/assets/automations/gather_facts/database/oracle/manifest.yml index d350579d6..e39522b75 100644 --- a/apps/assets/automations/gather_facts/database/oracle/manifest.yml +++ b/apps/assets/automations/gather_facts/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: gather_facts_oracle -name: Gather facts from Oracle +name: "{{ 'Gather facts from Oracle' | trans }}" category: database type: - oracle method: gather_facts +i18n: + Gather facts from Oracle: + zh: 从 Oracle 获取信息 + en: Gather facts from Oracle + ja: Oracleから事実を取得する diff --git a/apps/assets/automations/gather_facts/database/postgresql/manifest.yml b/apps/assets/automations/gather_facts/database/postgresql/manifest.yml index 19bf255de..288298d96 100644 --- a/apps/assets/automations/gather_facts/database/postgresql/manifest.yml +++ b/apps/assets/automations/gather_facts/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: gather_facts_postgresql -name: Gather facts for PostgreSQL +name: "{{ 'Gather facts for PostgreSQL' | trans }}" category: database type: - postgresql method: gather_facts +i18n: + Gather facts for PostgreSQL: + zh: 从 PostgreSQL 获取信息 + en: Gather facts for PostgreSQL + ja: PostgreSQLから事実を取得する diff --git a/apps/assets/automations/gather_facts/host/posix/manifest.yml b/apps/assets/automations/gather_facts/host/posix/manifest.yml index b59b701aa..78eb1d897 100644 --- a/apps/assets/automations/gather_facts/host/posix/manifest.yml +++ b/apps/assets/automations/gather_facts/host/posix/manifest.yml @@ -1,7 +1,12 @@ id: gather_facts_posix -name: Gather posix facts +name: "{{ 'Gather posix facts' | trans }}" category: host type: - linux - unix method: gather_facts +i18n: + Gather posix facts: + zh: 从 Posix 主机获取信息 + en: Gather posix facts + ja: Posixから事実を取得する diff --git a/apps/assets/automations/gather_facts/host/windows/manifest.yml b/apps/assets/automations/gather_facts/host/windows/manifest.yml index 929a6626f..af7c50f68 100644 --- a/apps/assets/automations/gather_facts/host/windows/manifest.yml +++ b/apps/assets/automations/gather_facts/host/windows/manifest.yml @@ -1,7 +1,12 @@ id: gather_facts_windows -name: Gather facts windows +name: "{{ 'Gather facts windows' | trans }}" version: 1 method: gather_facts category: host type: - windows +i18n: + Gather facts windows: + zh: 从 Windows 获取信息 + en: Gather facts windows + ja: Windowsから事実を取得する diff --git a/apps/assets/automations/ping/database/mongodb/manifest.yml b/apps/assets/automations/ping/database/mongodb/manifest.yml index 45b90eb72..bdc0d73db 100644 --- a/apps/assets/automations/ping/database/mongodb/manifest.yml +++ b/apps/assets/automations/ping/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: mongodb_ping -name: Ping MongoDB +name: "{{ 'Ping MongoDB' | trans }}" category: database type: - mongodb method: ping +i18n: + Ping MongoDB: + zh: 测试 MongoDB 可连接性 + en: Ping MongoDB + ja: MongoDBにPingする diff --git a/apps/assets/automations/ping/database/mysql/manifest.yml b/apps/assets/automations/ping/database/mysql/manifest.yml index 044907c6a..0452a8293 100644 --- a/apps/assets/automations/ping/database/mysql/manifest.yml +++ b/apps/assets/automations/ping/database/mysql/manifest.yml @@ -1,7 +1,12 @@ id: mysql_ping -name: Ping MySQL +name: "{{ 'Ping MySQL' | trans }}" category: database type: - mysql - mariadb method: ping +i18n: + Ping MySQL: + zh: 测试 MySQL 可连接性 + en: Ping MySQL + ja: MySQLにPingする diff --git a/apps/assets/automations/ping/database/oracle/manifest.yml b/apps/assets/automations/ping/database/oracle/manifest.yml index 3912941c3..bc55805b3 100644 --- a/apps/assets/automations/ping/database/oracle/manifest.yml +++ b/apps/assets/automations/ping/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: oracle_ping -name: Ping Oracle +name: "{{ 'Ping Oracle' | trans }}" category: database type: - oracle method: ping +i18n: + Ping Oracle: + zh: 测试 Oracle 可连接性 + en: Ping Oracle + ja: OracleにPingする diff --git a/apps/assets/automations/ping/database/postgresql/manifest.yml b/apps/assets/automations/ping/database/postgresql/manifest.yml index 337b2b50d..f7d7c3602 100644 --- a/apps/assets/automations/ping/database/postgresql/manifest.yml +++ b/apps/assets/automations/ping/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: ping_postgresql -name: Ping PostgreSQL +name: "{{ 'Ping PostgreSQL' | trans }}" category: database type: - postgresql method: ping +i18n: + Ping PostgreSQL: + zh: 测试 PostgreSQL 可连接性 + en: Ping PostgreSQL + ja: PostgreSQLにPingする diff --git a/apps/assets/automations/ping/database/sqlserver/manifest.yml b/apps/assets/automations/ping/database/sqlserver/manifest.yml index b5cd6bf88..fe11e7486 100644 --- a/apps/assets/automations/ping/database/sqlserver/manifest.yml +++ b/apps/assets/automations/ping/database/sqlserver/manifest.yml @@ -1,6 +1,11 @@ id: sqlserver_ping -name: Ping SQLServer +name: "{{ 'Ping SQLServer' | trans }}" category: database type: - sqlserver method: ping +i18n: + Ping SQLServer: + zh: 测试 SQLServer 可连接性 + en: Ping SQLServer + ja: SQLServerにPingする diff --git a/apps/assets/automations/ping/host/posix/manifest.yml b/apps/assets/automations/ping/host/posix/manifest.yml index 1e6143480..ebc1046db 100644 --- a/apps/assets/automations/ping/host/posix/manifest.yml +++ b/apps/assets/automations/ping/host/posix/manifest.yml @@ -8,6 +8,6 @@ method: ping i18n: Posix ping: - zh: Posix ping + zh: 测试 Posix 可连接性 en: Posix ping ja: Posix ピング diff --git a/apps/assets/automations/ping/host/windows/manifest.yml b/apps/assets/automations/ping/host/windows/manifest.yml index 6218e5978..6798c1198 100644 --- a/apps/assets/automations/ping/host/windows/manifest.yml +++ b/apps/assets/automations/ping/host/windows/manifest.yml @@ -1,7 +1,12 @@ id: win_ping -name: Windows ping +name: "{{ 'Windows ping' | trans }}" version: 1 method: ping category: host type: - windows +i18n: + Windows ping: + zh: 测试 Windows 可连接性 + en: Windows ping + ja: Windows ピング From f030638ba432cd17fdd267fd2e6794dce97724a5 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Thu, 20 Apr 2023 14:05:00 +0800 Subject: [PATCH 40/48] perf: account auto i18n --- .../automations/change_secret/custom/ssh/manifest.yml | 9 +++++++-- .../change_secret/database/mongodb/manifest.yml | 7 ++++++- .../change_secret/database/mysql/manifest.yml | 7 ++++++- .../change_secret/database/oracle/manifest.yml | 7 ++++++- .../change_secret/database/postgresql/manifest.yml | 7 ++++++- .../change_secret/database/sqlserver/manifest.yml | 7 ++++++- .../automations/change_secret/host/aix/manifest.yml | 7 ++++++- .../automations/change_secret/host/posix/manifest.yml | 7 ++++++- .../change_secret/host/windows/manifest.yml | 7 ++++++- .../gather_accounts/database/mongodb/manifest.yml | 7 ++++++- .../gather_accounts/database/mysql/manifest.yml | 11 ++++------- .../gather_accounts/database/oracle/manifest.yml | 7 ++++++- .../gather_accounts/database/postgresql/manifest.yml | 7 ++++++- .../gather_accounts/host/posix/manifest.yml | 7 ++++++- .../gather_accounts/host/windows/manifest.yml | 7 ++++++- .../push_account/database/mongodb/manifest.yml | 7 ++++++- .../push_account/database/mysql/manifest.yml | 7 ++++++- .../push_account/database/oracle/manifest.yml | 7 ++++++- .../push_account/database/postgresql/manifest.yml | 7 ++++++- .../push_account/database/sqlserver/manifest.yml | 7 ++++++- .../automations/push_account/host/aix/manifest.yml | 7 ++++++- .../automations/push_account/host/posix/manifest.yml | 7 ++++++- .../push_account/host/windows/manifest.yml | 7 ++++++- .../automations/verify_account/custom/manifest.yml | 7 ++++++- .../verify_account/database/mongodb/manifest.yml | 7 ++++++- .../verify_account/database/mysql/manifest.yml | 7 ++++++- .../verify_account/database/oracle/manifest.yml | 7 ++++++- .../verify_account/database/postgresql/manifest.yml | 7 ++++++- .../verify_account/database/sqlserver/manifest.yml | 7 ++++++- .../verify_account/host/posix/manifest.yml | 7 ++++++- .../verify_account/host/windows/manifest.yml | 7 ++++++- apps/assets/api/platform.py | 2 +- 32 files changed, 186 insertions(+), 39 deletions(-) diff --git a/apps/accounts/automations/change_secret/custom/ssh/manifest.yml b/apps/accounts/automations/change_secret/custom/ssh/manifest.yml index 465cfa1e2..3ac25a231 100644 --- a/apps/accounts/automations/change_secret/custom/ssh/manifest.yml +++ b/apps/accounts/automations/change_secret/custom/ssh/manifest.yml @@ -1,5 +1,5 @@ id: change_secret_by_ssh -name: Change secret by SSH +name: "{{ 'SSH account change secret' | trans }}" category: - device - host @@ -10,5 +10,10 @@ params: - name: commands type: list label: '自定义命令' - default: [''] + default: [ '' ] help_text: '自定义命令中如需包含账号的 账号、密码、SSH 连接的用户密码 字段,
请使用 {username}、{password}、{login_password}格式,执行任务时会进行替换 。
比如针对 Cisco 主机进行改密,一般需要配置五条命令:
1. enable
2. {login_password}
3. configure terminal
4. username {username} privilege 0 password {password}
5. end' + +i18n: + SSH account change secret: + zh: SSH 账号改密 + ja: SSH アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/database/mongodb/manifest.yml b/apps/accounts/automations/change_secret/database/mongodb/manifest.yml index b6eeaa139..ce4f6fecf 100644 --- a/apps/accounts/automations/change_secret/database/mongodb/manifest.yml +++ b/apps/accounts/automations/change_secret/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: change_secret_mongodb -name: Change secret for MongoDB +name: "{{ 'MongoDB account change secret' | trans }}" category: database type: - mongodb method: change_secret + +i18n: + MongoDB account change secret: + zh: MongoDB 账号改密 + ja: MongoDB アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/database/mysql/manifest.yml b/apps/accounts/automations/change_secret/database/mysql/manifest.yml index eac0fb56b..554acd8ba 100644 --- a/apps/accounts/automations/change_secret/database/mysql/manifest.yml +++ b/apps/accounts/automations/change_secret/database/mysql/manifest.yml @@ -1,7 +1,12 @@ id: change_secret_mysql -name: Change secret for MySQL +name: "{{ 'MySQL account change secret' | trans }}" category: database type: - mysql - mariadb method: change_secret + +i18n: + MySQL account change secret: + zh: MySQL 账号改密 + ja: MySQL アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/database/oracle/manifest.yml b/apps/accounts/automations/change_secret/database/oracle/manifest.yml index ee5cee177..2d88c7fcd 100644 --- a/apps/accounts/automations/change_secret/database/oracle/manifest.yml +++ b/apps/accounts/automations/change_secret/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: change_secret_oracle -name: Change secret for Oracle +name: "{{ 'Oracle account change secret' | trans }}" category: database type: - oracle method: change_secret + +i18n: + Oracle account change secret: + zh: Oracle 账号改密 + ja: Oracle アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/database/postgresql/manifest.yml b/apps/accounts/automations/change_secret/database/postgresql/manifest.yml index 048637c7f..29c66e2ce 100644 --- a/apps/accounts/automations/change_secret/database/postgresql/manifest.yml +++ b/apps/accounts/automations/change_secret/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: change_secret_postgresql -name: Change secret for PostgreSQL +name: "{{ 'PostgreSQL account change secret' | trans }}" category: database type: - postgresql method: change_secret + +i18n: + PostgreSQL account change secret: + zh: PostgreSQL 账号改密 + ja: PostgreSQL アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/database/sqlserver/manifest.yml b/apps/accounts/automations/change_secret/database/sqlserver/manifest.yml index 2a436e27f..58d764a08 100644 --- a/apps/accounts/automations/change_secret/database/sqlserver/manifest.yml +++ b/apps/accounts/automations/change_secret/database/sqlserver/manifest.yml @@ -1,6 +1,11 @@ id: change_secret_sqlserver -name: Change secret for SQLServer +name: "{{ 'SQLServer account change secret' | trans }}" category: database type: - sqlserver method: change_secret + +i18n: + SQLServer account change secret: + zh: SQLServer 账号改密 + ja: SQLServer アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/host/aix/manifest.yml b/apps/accounts/automations/change_secret/host/aix/manifest.yml index 5c44f0350..d95c07032 100644 --- a/apps/accounts/automations/change_secret/host/aix/manifest.yml +++ b/apps/accounts/automations/change_secret/host/aix/manifest.yml @@ -1,6 +1,11 @@ id: change_secret_aix -name: Change secret for aix +name: "{{ 'AIX account change secret' | trans }}" category: host type: - AIX method: change_secret + +i18n: + AIX account change secret: + zh: AIX 账号改密 + ja: AIX アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/host/posix/manifest.yml b/apps/accounts/automations/change_secret/host/posix/manifest.yml index 491fb14a2..8c6c0d48d 100644 --- a/apps/accounts/automations/change_secret/host/posix/manifest.yml +++ b/apps/accounts/automations/change_secret/host/posix/manifest.yml @@ -1,7 +1,12 @@ id: change_secret_posix -name: Change secret for posix +name: "{{ 'Posix account change secret' | trans }}" category: host type: - unix - linux method: change_secret + +i18n: + Posix account change secret: + zh: Posix 账号改密 + ja: Posix アカウントのパスワード変更 diff --git a/apps/accounts/automations/change_secret/host/windows/manifest.yml b/apps/accounts/automations/change_secret/host/windows/manifest.yml index d727e3bec..f04666c66 100644 --- a/apps/accounts/automations/change_secret/host/windows/manifest.yml +++ b/apps/accounts/automations/change_secret/host/windows/manifest.yml @@ -1,7 +1,12 @@ id: change_secret_local_windows -name: Change secret local account for Windows +name: "{{ 'Windows account change secret' | trans }}" version: 1 method: change_secret category: host type: - windows + +i18n: + Windows account change secret: + zh: Windows 账号改密 + ja: Windows アカウントのパスワード変更 diff --git a/apps/accounts/automations/gather_accounts/database/mongodb/manifest.yml b/apps/accounts/automations/gather_accounts/database/mongodb/manifest.yml index a002848b4..fa35c95a0 100644 --- a/apps/accounts/automations/gather_accounts/database/mongodb/manifest.yml +++ b/apps/accounts/automations/gather_accounts/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: gather_accounts_mongodb -name: Gather account from MongoDB +name: "{{ 'MongoDB account gather' | trans }}" category: database type: - mongodb method: gather_accounts + +i18n: + MongoDB account gather: + zh: MongoDB 账号收集 + ja: MongoDB アカウントの収集 diff --git a/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml b/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml index 22f57156c..bd160ed34 100644 --- a/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml +++ b/apps/accounts/automations/gather_accounts/database/mysql/manifest.yml @@ -1,5 +1,5 @@ id: gather_accounts_mysql -name: "{{ 'Gather account from MySQL' | trans }}" +name: "{{ 'MySQL account gather' | trans }}" category: database type: - mysql @@ -7,9 +7,6 @@ type: method: gather_accounts i18n: - en: - Gather account from MySQL: Gather account from MySQL - zh: - Gather account from MySQL: 从MySQL获取账号 - ja: - Gather account from MySQL: MySQLからアカウントを取得する + MySQL account gather: + zh: MySQL 账号收集 + ja: MySQL アカウントの収集 diff --git a/apps/accounts/automations/gather_accounts/database/oracle/manifest.yml b/apps/accounts/automations/gather_accounts/database/oracle/manifest.yml index 4753f1495..ccfd7cb86 100644 --- a/apps/accounts/automations/gather_accounts/database/oracle/manifest.yml +++ b/apps/accounts/automations/gather_accounts/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: gather_accounts_oracle -name: Gather account from Oracle +name: "{{ 'Oracle account gather' | trans }}" category: database type: - oracle method: gather_accounts + +i18n: + Oracle account gather: + zh: Oracle 账号收集 + ja: Oracle アカウントの収集 diff --git a/apps/accounts/automations/gather_accounts/database/postgresql/manifest.yml b/apps/accounts/automations/gather_accounts/database/postgresql/manifest.yml index 3e563053a..af41c50ef 100644 --- a/apps/accounts/automations/gather_accounts/database/postgresql/manifest.yml +++ b/apps/accounts/automations/gather_accounts/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: gather_accounts_postgresql -name: Gather account for PostgreSQL +name: "{{ 'PostgreSQL account gather' | trans }}" category: database type: - postgresql method: gather_accounts + +i18n: + PostgreSQL account gather: + zh: PostgreSQL 账号收集 + ja: PostgreSQL アカウントの収集 diff --git a/apps/accounts/automations/gather_accounts/host/posix/manifest.yml b/apps/accounts/automations/gather_accounts/host/posix/manifest.yml index a761c9796..33534e183 100644 --- a/apps/accounts/automations/gather_accounts/host/posix/manifest.yml +++ b/apps/accounts/automations/gather_accounts/host/posix/manifest.yml @@ -1,7 +1,12 @@ id: gather_accounts_posix -name: Gather posix account +name: "{{ 'Posix account gather' | trans }}" category: host type: - linux - unix method: gather_accounts + +i18n: + Posix account gather: + zh: Posix 账号收集 + ja: Posix アカウントの収集 diff --git a/apps/accounts/automations/gather_accounts/host/windows/manifest.yml b/apps/accounts/automations/gather_accounts/host/windows/manifest.yml index ffc2ef7ee..281f095fe 100644 --- a/apps/accounts/automations/gather_accounts/host/windows/manifest.yml +++ b/apps/accounts/automations/gather_accounts/host/windows/manifest.yml @@ -1,7 +1,12 @@ id: gather_accounts_windows -name: Gather account windows +name: "{{ 'Windows account gather' | trans }}" version: 1 method: gather_accounts category: host type: - windows + +i18n: + Windows account gather: + zh: Windows 账号收集 + ja: Windows アカウントの収集 diff --git a/apps/accounts/automations/push_account/database/mongodb/manifest.yml b/apps/accounts/automations/push_account/database/mongodb/manifest.yml index 6c91977bf..b4c237f78 100644 --- a/apps/accounts/automations/push_account/database/mongodb/manifest.yml +++ b/apps/accounts/automations/push_account/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: push_account_mongodb -name: Push account for MongoDB +name: "{{ 'MongoDB account push' | trans }}" category: database type: - mongodb method: push_account + +i18n: + MongoDB account push: + zh: MongoDB 账号推送 + ja: MongoDB アカウントのプッシュ diff --git a/apps/accounts/automations/push_account/database/mysql/manifest.yml b/apps/accounts/automations/push_account/database/mysql/manifest.yml index 712d0bfb8..56e144a3f 100644 --- a/apps/accounts/automations/push_account/database/mysql/manifest.yml +++ b/apps/accounts/automations/push_account/database/mysql/manifest.yml @@ -1,7 +1,12 @@ id: push_account_mysql -name: Push account for MySQL +name: "{{ 'MySQL account push' | trans }}" category: database type: - mysql - mariadb method: push_account + +i18n: + MySQL account push: + zh: MySQL 账号推送 + ja: MySQL アカウントのプッシュ diff --git a/apps/accounts/automations/push_account/database/oracle/manifest.yml b/apps/accounts/automations/push_account/database/oracle/manifest.yml index f60215892..729dc4ec7 100644 --- a/apps/accounts/automations/push_account/database/oracle/manifest.yml +++ b/apps/accounts/automations/push_account/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: push_account_oracle -name: Push account for Oracle +name: "{{ 'Oracle account push' | trans }}" category: database type: - oracle method: push_account + +i18n: + Oracle account push: + zh: Oracle 账号推送 + ja: Oracle アカウントのプッシュ \ No newline at end of file diff --git a/apps/accounts/automations/push_account/database/postgresql/manifest.yml b/apps/accounts/automations/push_account/database/postgresql/manifest.yml index 6488ddd5a..4c8e7febb 100644 --- a/apps/accounts/automations/push_account/database/postgresql/manifest.yml +++ b/apps/accounts/automations/push_account/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: push_account_postgresql -name: Push account for PostgreSQL +name: "{{ 'PostgreSQL account push' | trans }}" category: database type: - postgresql method: push_account + +i18n: + PostgreSQL account push: + zh: PostgreSQL 账号推送 + ja: PostgreSQL アカウントのプッシュ \ No newline at end of file diff --git a/apps/accounts/automations/push_account/database/sqlserver/manifest.yml b/apps/accounts/automations/push_account/database/sqlserver/manifest.yml index f1dc32b66..058e75ca7 100644 --- a/apps/accounts/automations/push_account/database/sqlserver/manifest.yml +++ b/apps/accounts/automations/push_account/database/sqlserver/manifest.yml @@ -1,6 +1,11 @@ id: push_account_sqlserver -name: Push account for SQLServer +name: "{{ 'SQLServer account push' | trans }}" category: database type: - sqlserver method: push_account + +i18n: + SQLServer account push: + zh: SQLServer 账号推送 + ja: SQLServer アカウントのプッシュ diff --git a/apps/accounts/automations/push_account/host/aix/manifest.yml b/apps/accounts/automations/push_account/host/aix/manifest.yml index ccc051eac..78a44a4e9 100644 --- a/apps/accounts/automations/push_account/host/aix/manifest.yml +++ b/apps/accounts/automations/push_account/host/aix/manifest.yml @@ -1,5 +1,5 @@ id: push_account_aix -name: Push account for aix +name: "{{ 'Aix account push' | trans }}" category: host type: - AIX @@ -22,3 +22,8 @@ params: default: '' help_text: '请输入用户组,多个用户组使用逗号分隔(需填写已存在的用户组)' +i18n: + Aix account push: + zh: Aix 账号推送 + ja: Aix アカウントのプッシュ + diff --git a/apps/accounts/automations/push_account/host/posix/manifest.yml b/apps/accounts/automations/push_account/host/posix/manifest.yml index 382b48add..efeb11b93 100644 --- a/apps/accounts/automations/push_account/host/posix/manifest.yml +++ b/apps/accounts/automations/push_account/host/posix/manifest.yml @@ -1,5 +1,5 @@ id: push_account_posix -name: Push account for posix +name: "{{ 'Posix account push' | trans }}" category: host type: - unix @@ -23,3 +23,8 @@ params: label: '用户组' default: '' help_text: '请输入用户组,多个用户组使用逗号分隔(需填写已存在的用户组)' + +i18n: + Posix account push: + zh: Posix 账号推送 + ja: Posix アカウントのプッシュ diff --git a/apps/accounts/automations/push_account/host/windows/manifest.yml b/apps/accounts/automations/push_account/host/windows/manifest.yml index 05e3127f9..28745245f 100644 --- a/apps/accounts/automations/push_account/host/windows/manifest.yml +++ b/apps/accounts/automations/push_account/host/windows/manifest.yml @@ -1,5 +1,5 @@ id: push_account_local_windows -name: Push account local account for Windows +name: "{{ 'Windows account push' | trans }}" version: 1 method: push_account category: host @@ -11,3 +11,8 @@ params: label: '用户组' default: 'Users,Remote Desktop Users' help_text: '请输入用户组,多个用户组使用逗号分隔(需填写已存在的用户组)' + +i18n: + Windows account push: + zh: Windows 账号推送 + ja: Windows アカウントのプッシュ diff --git a/apps/accounts/automations/verify_account/custom/manifest.yml b/apps/accounts/automations/verify_account/custom/manifest.yml index 51c5fedb1..ceef8e50d 100644 --- a/apps/accounts/automations/verify_account/custom/manifest.yml +++ b/apps/accounts/automations/verify_account/custom/manifest.yml @@ -1,8 +1,13 @@ id: verify_account_by_ssh -name: Verify account by SSH +name: "{{ 'SSH account verify' | trans }}" category: - device - host type: - all method: verify_account + +i18n: + SSH account verify: + zh: SSH 账号验证 + ja: SSH アカウントの検証 diff --git a/apps/accounts/automations/verify_account/database/mongodb/manifest.yml b/apps/accounts/automations/verify_account/database/mongodb/manifest.yml index 24cc398c2..fd5a31294 100644 --- a/apps/accounts/automations/verify_account/database/mongodb/manifest.yml +++ b/apps/accounts/automations/verify_account/database/mongodb/manifest.yml @@ -1,6 +1,11 @@ id: verify_account_mongodb -name: Verify account from MongoDB +name: "{{ 'MongoDB account verify' | trans }}" category: database type: - mongodb method: verify_account + +i18n: + MongoDB account verify: + zh: MongoDB 账号验证 + ja: MongoDB アカウントの検証 diff --git a/apps/accounts/automations/verify_account/database/mysql/manifest.yml b/apps/accounts/automations/verify_account/database/mysql/manifest.yml index 48d4bb4c4..bd381de0b 100644 --- a/apps/accounts/automations/verify_account/database/mysql/manifest.yml +++ b/apps/accounts/automations/verify_account/database/mysql/manifest.yml @@ -1,7 +1,12 @@ id: verify_account_mysql -name: Verify account from MySQL +name: "{{ 'MySQL account verify' | trans }}" category: database type: - mysql - mariadb method: verify_account + +i18n: + MySQL account verify: + zh: MySQL 账号验证 + ja: MySQL アカウントの検証 diff --git a/apps/accounts/automations/verify_account/database/oracle/manifest.yml b/apps/accounts/automations/verify_account/database/oracle/manifest.yml index b58a7f888..220445daa 100644 --- a/apps/accounts/automations/verify_account/database/oracle/manifest.yml +++ b/apps/accounts/automations/verify_account/database/oracle/manifest.yml @@ -1,6 +1,11 @@ id: verify_account_oracle -name: Verify account from Oracle +name: "{{ 'Oracle account verify' | trans }}" category: database type: - oracle method: verify_account + +i18n: + Oracle account verify: + zh: Oracle 账号验证 + ja: Oracle アカウントの検証 diff --git a/apps/accounts/automations/verify_account/database/postgresql/manifest.yml b/apps/accounts/automations/verify_account/database/postgresql/manifest.yml index 4c9e2cbec..6ce7175b3 100644 --- a/apps/accounts/automations/verify_account/database/postgresql/manifest.yml +++ b/apps/accounts/automations/verify_account/database/postgresql/manifest.yml @@ -1,6 +1,11 @@ id: verify_account_postgresql -name: Verify account for PostgreSQL +name: "{{ 'PostgreSQL account verify' | trans }}" category: database type: - postgresql method: verify_account + +i18n: + PostgreSQL account verify: + zh: PostgreSQL 账号验证 + ja: PostgreSQL アカウントの検証 diff --git a/apps/accounts/automations/verify_account/database/sqlserver/manifest.yml b/apps/accounts/automations/verify_account/database/sqlserver/manifest.yml index 8af52ab0b..8effdcfeb 100644 --- a/apps/accounts/automations/verify_account/database/sqlserver/manifest.yml +++ b/apps/accounts/automations/verify_account/database/sqlserver/manifest.yml @@ -1,6 +1,11 @@ id: verify_account_sqlserver -name: Verify account from SQLServer +name: "{{ 'SQLServer account verify' | trans }}" category: database type: - sqlserver method: verify_account + +i18n: + SQLServer account verify: + zh: SQLServer 账号验证 + ja: SQLServer アカウントの検証 \ No newline at end of file diff --git a/apps/accounts/automations/verify_account/host/posix/manifest.yml b/apps/accounts/automations/verify_account/host/posix/manifest.yml index 5b9a1e51b..26ee3b025 100644 --- a/apps/accounts/automations/verify_account/host/posix/manifest.yml +++ b/apps/accounts/automations/verify_account/host/posix/manifest.yml @@ -1,7 +1,12 @@ id: verify_account_posix -name: Verify posix account +name: "{{ 'Posix account verify' | trans }}" category: host type: - linux - unix method: verify_account + +i18n: + Posix account verify: + zh: Posix 账号验证 + ja: Posix アカウントの検証 \ No newline at end of file diff --git a/apps/accounts/automations/verify_account/host/windows/manifest.yml b/apps/accounts/automations/verify_account/host/windows/manifest.yml index 69faf4217..28b914d10 100644 --- a/apps/accounts/automations/verify_account/host/windows/manifest.yml +++ b/apps/accounts/automations/verify_account/host/windows/manifest.yml @@ -1,7 +1,12 @@ id: verify_account_windows -name: Verify account windows +name: "{{ 'Windows account verify' | trans }}" version: 1 method: verify_account category: host type: - windows + +i18n: + Windows account verify: + zh: Windows 账号验证 + ja: Windows アカウントの検証 diff --git a/apps/assets/api/platform.py b/apps/assets/api/platform.py index 61f4db985..fc32a3b5f 100644 --- a/apps/assets/api/platform.py +++ b/apps/assets/api/platform.py @@ -71,7 +71,7 @@ class PlatformAutomationMethodsApi(generics.ListAPIView): def generate_serializer_fields(self): data = self.automation_methods() fields = { - i['id']: i['params_serializer']() + i['id']: i['params_serializer'](label=i['name']) if i['params_serializer'] else None for i in data } From be58539df8c107abbfb805530efcc16a8cad2fe6 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 14:19:13 +0800 Subject: [PATCH 41/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/yml.py | 4 ++-- apps/rbac/const.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/common/utils/yml.py b/apps/common/utils/yml.py index 540f1a31f..ccc151c8c 100644 --- a/apps/common/utils/yml.py +++ b/apps/common/utils/yml.py @@ -1,12 +1,12 @@ import io import yaml -from django.utils.translation import get_language +from django.conf import settings from jinja2 import Environment def translate(i18n, key): - lang = get_language()[:2] + lang = settings.LANGUAGE_CODE[:2] lang_data = i18n.get(key, {}) return lang_data.get(lang, key) diff --git a/apps/rbac/const.py b/apps/rbac/const.py index 4ab48161c..786cb74cc 100644 --- a/apps/rbac/const.py +++ b/apps/rbac/const.py @@ -146,6 +146,8 @@ only_system_permissions = ( ('authentication', '*', '*', '*'), ('tickets', '*', '*', '*'), ('orgs', 'organization', 'view', 'rootorg'), + ('terminal', 'applet', '*', '*'), + ('terminal', 'applethost', '*', '*'), ) only_org_permissions = ( From b52f18aea6c6acc780372309f93400eafcd6217b Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 14:39:31 +0800 Subject: [PATCH 42/48] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/yml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/utils/yml.py b/apps/common/utils/yml.py index ccc151c8c..6db03ea63 100644 --- a/apps/common/utils/yml.py +++ b/apps/common/utils/yml.py @@ -5,7 +5,7 @@ from django.conf import settings from jinja2 import Environment -def translate(i18n, key): +def translate(key, i18n): lang = settings.LANGUAGE_CODE[:2] lang_data = i18n.get(key, {}) return lang_data.get(lang, key) @@ -18,7 +18,7 @@ def yaml_load_with_i18n(stream): i18n = yaml_data.get('i18n', {}) env = Environment() - env.filters['trans'] = lambda key: translate(i18n, key) + env.filters['trans'] = lambda key: translate(key, i18n) template = env.from_string(ori_text) yaml_data = template.render() yaml_f = io.StringIO(yaml_data) From 0de6c4140678edfa2f73bb23b912903dd8fed544 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:43:40 +0800 Subject: [PATCH 43/48] perf: update templat account (#10274) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/template.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/accounts/serializers/account/template.py b/apps/accounts/serializers/account/template.py index e9804876b..f6ac16224 100644 --- a/apps/accounts/serializers/account/template.py +++ b/apps/accounts/serializers/account/template.py @@ -1,3 +1,4 @@ +from django.db.transaction import atomic from django.db.utils import IntegrityError from accounts.models import AccountTemplate, Account @@ -20,6 +21,7 @@ class AccountTemplateSerializer(BaseAccountSerializer): pass # TODO 数据库访问的太多了 后期优化 + @atomic() def bulk_update_accounts(self, instance, diff): accounts = Account.objects.filter(source_id=instance.id) if not accounts: From dac708f952f9725f3ee60d0f420b06627a3a3ae3 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 15:23:00 +0800 Subject: [PATCH 44/48] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20api=20doc=20?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/asset/common.py | 7 ++++--- apps/assets/serializers/asset/custom.py | 4 ++-- apps/common/serializers/common.py | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 9d3bcb097..311749d61 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -13,6 +13,7 @@ from common.serializers import ( WritableNestedModelSerializer, SecretReadableMixin, CommonModelSerializer, MethodSerializer ) +from common.serializers.common import DictSerializer from common.serializers.fields import LabeledChoiceField from orgs.mixins.serializers import BulkOrgResourceModelSerializer from ...const import Category, AllTypes @@ -326,19 +327,19 @@ class DetailMixin(serializers.Serializer): category = request.query_params.get('category') else: instance = self.get_instance() - category = instance.category + category = instance.category if instance else 'host' return category def get_gathered_info_serializer(self): category = self.get_category() from .info.gathered import category_gathered_serializer_map - serializer_cls = category_gathered_serializer_map.get(category, serializers.DictField) + serializer_cls = category_gathered_serializer_map.get(category, DictSerializer) return serializer_cls() def get_spec_info_serializer(self): category = self.get_category() from .info.spec import category_spec_serializer_map - serializer_cls = category_spec_serializer_map.get(category, serializers.DictField) + serializer_cls = category_spec_serializer_map.get(category, DictSerializer) return serializer_cls() diff --git a/apps/assets/serializers/asset/custom.py b/apps/assets/serializers/asset/custom.py index 5e5cd774c..d857aaa8b 100644 --- a/apps/assets/serializers/asset/custom.py +++ b/apps/assets/serializers/asset/custom.py @@ -1,10 +1,10 @@ from django.db.models import QuerySet from django.utils.translation import gettext_lazy as _ -from rest_framework import serializers from assets.models import Custom, Platform, Asset from common.const import UUID_PATTERN from common.serializers import MethodSerializer, create_serializer_class +from common.serializers.common import DictSerializer from .common import AssetSerializer __all__ = ['CustomSerializer'] @@ -19,7 +19,7 @@ class CustomSerializer(AssetSerializer): def get_custom_info_serializer(self): request = self.context.get('request') - default_field = serializers.DictField(required=False, label=_('Custom info')) + default_field = DictSerializer() if not request: return default_field diff --git a/apps/common/serializers/common.py b/apps/common/serializers/common.py index 208023ac4..cd91f269c 100644 --- a/apps/common/serializers/common.py +++ b/apps/common/serializers/common.py @@ -96,3 +96,17 @@ class WritableNestedModelSerializer(NestedModelSerializer): class FileSerializer(serializers.Serializer): file = serializers.FileField(label=_("File")) + + +class DictSerializer(serializers.Serializer): + + def to_representation(self, instance): + # 返回一个包含所有提交字段的 Python 字典 + return instance + + def to_internal_value(self, data): + # 确保从请求中得到的输入是 Python 字典 + if isinstance(data, dict): + return data + else: + raise serializers.ValidationError("无法转换为dict类型") From ee122690ff71cf5ede30cc7f5ce2dcbe9b18f657 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Thu, 20 Apr 2023 15:47:21 +0800 Subject: [PATCH 45/48] perf: asset date_updated --- apps/assets/api/asset/asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/assets/api/asset/asset.py b/apps/assets/api/asset/asset.py index d7321aef8..469c2a95f 100644 --- a/apps/assets/api/asset/asset.py +++ b/apps/assets/api/asset/asset.py @@ -96,7 +96,7 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet): model = Asset filterset_class = AssetFilterSet search_fields = ("name", "address") - ordering_fields = ('name', 'connectivity', 'platform') + ordering_fields = ('name', 'connectivity', 'platform', 'date_updated') serializer_classes = ( ("default", serializers.AssetSerializer), ("platform", serializers.PlatformSerializer), From 177d634d85301a48de0ea1f8935ffd41bbe7b249 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Apr 2023 15:46:12 +0800 Subject: [PATCH 46/48] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=20acl=20=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/acls/models/base.py | 2 +- apps/acls/serializers/login_acl.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/acls/models/base.py b/apps/acls/models/base.py index 4649cd626..2624e34cd 100644 --- a/apps/acls/models/base.py +++ b/apps/acls/models/base.py @@ -1,7 +1,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from django.db.models import Q -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from common.db.models import JMSBaseModel from common.utils import contains_ip diff --git a/apps/acls/serializers/login_acl.py b/apps/acls/serializers/login_acl.py index fb826361a..74677b84b 100644 --- a/apps/acls/serializers/login_acl.py +++ b/apps/acls/serializers/login_acl.py @@ -1,12 +1,13 @@ from django.utils.translation import ugettext as _ from rest_framework import serializers -from common.serializers.fields import ObjectRelatedField, LabeledChoiceField from common.serializers import BulkModelSerializer, MethodSerializer +from common.serializers.fields import ObjectRelatedField, LabeledChoiceField from jumpserver.utils import has_valid_xpack_license from users.models import User from .rules import RuleSerializer from ..models import LoginACL +from ..models.base import ActionChoices __all__ = [ "LoginACLSerializer", @@ -22,7 +23,7 @@ class LoginACLSerializer(BulkModelSerializer): reviewers = ObjectRelatedField( queryset=User.objects, label=_("Reviewers"), many=True, required=False ) - action = LabeledChoiceField(choices=LoginACL.ActionChoices.choices, label=_('Action')) + action = LabeledChoiceField(choices=ActionChoices.choices, label=_('Action')) reviewers_amount = serializers.IntegerField( read_only=True, source="reviewers.count", label=_("Reviewers amount") ) @@ -55,7 +56,7 @@ class LoginACLSerializer(BulkModelSerializer): choices = action.choices if not has_valid_xpack_license(): choices.pop(LoginACL.ActionChoices.review, None) - action.choices = choices + action._choices = choices def get_rules_serializer(self): return RuleSerializer() From 10b033ee97c2375a2fc173cd52b4ca732339fa7e Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:22:02 +0800 Subject: [PATCH 47/48] =?UTF-8?q?perf:=20=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B5=84=E4=BA=A7=E6=B6=88=E6=81=AF=20(#10280)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/assets/api/asset/asset.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/assets/api/asset/asset.py b/apps/assets/api/asset/asset.py index 469c2a95f..ba048e236 100644 --- a/apps/assets/api/asset/asset.py +++ b/apps/assets/api/asset/asset.py @@ -111,7 +111,6 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet): ("gathered_info", "assets.view_asset"), ) extra_filter_backends = [LabelFilterBackend, IpInFilterBackend, NodeFilterBackend] - skip_assets = [] def get_serializer_class(self): cls = super().get_serializer_class() @@ -144,6 +143,7 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet): def filter_bulk_update_data(self): bulk_data = [] + skip_assets = [] for data in self.request.data: pk = data.get('id') platform = data.get('platform') @@ -155,16 +155,16 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet): if platform.type == asset.type: bulk_data.append(data) continue - self.skip_assets.append(asset) - return bulk_data + skip_assets.append(asset) + return bulk_data, skip_assets def bulk_update(self, request, *args, **kwargs): - bulk_data = self.filter_bulk_update_data() + bulk_data, skip_assets = self.filter_bulk_update_data() request._full_data = bulk_data response = super().bulk_update(request, *args, **kwargs) - if response.status_code == HTTP_200_OK and self.skip_assets: + if response.status_code == HTTP_200_OK and skip_assets: user = request.user - BulkUpdatePlatformSkipAssetUserMsg(user, self.skip_assets).publish() + BulkUpdatePlatformSkipAssetUserMsg(user, skip_assets).publish() return response From 2ae951e6e669f95ebe544a3a519058bd79bb012d Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 20 Apr 2023 17:49:50 +0800 Subject: [PATCH 48/48] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/acls/serializers/base.py | 4 +- apps/acls/serializers/login_acl.py | 2 +- apps/acls/serializers/rules/rules.py | 2 +- apps/locale/ja/LC_MESSAGES/django.mo | 4 +- apps/locale/ja/LC_MESSAGES/django.po | 225 ++++++++++-------------- apps/locale/zh/LC_MESSAGES/django.mo | 4 +- apps/locale/zh/LC_MESSAGES/django.po | 246 ++++++++------------------- 7 files changed, 162 insertions(+), 325 deletions(-) diff --git a/apps/acls/serializers/base.py b/apps/acls/serializers/base.py index 24b6867e7..dbdac67e7 100644 --- a/apps/acls/serializers/base.py +++ b/apps/acls/serializers/base.py @@ -7,7 +7,7 @@ from orgs.models import Organization from users.models import User common_help_text = _( - "Format for comma-delimited string, with * indicating a match all. " + "With * indicating a match all. " ) @@ -22,7 +22,7 @@ class ACLUsersSerializer(serializers.Serializer): class ACLAssestsSerializer(serializers.Serializer): address_group_help_text = _( - "Format for comma-delimited string, with * indicating a match all. " + "With * indicating a match all. " "Such as: " "192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64" " (Domain name support)" diff --git a/apps/acls/serializers/login_acl.py b/apps/acls/serializers/login_acl.py index 74677b84b..0a180d9e5 100644 --- a/apps/acls/serializers/login_acl.py +++ b/apps/acls/serializers/login_acl.py @@ -14,7 +14,7 @@ __all__ = [ ] common_help_text = _( - "Format for comma-delimited string, with * indicating a match all. " + "With * indicating a match all. " ) diff --git a/apps/acls/serializers/rules/rules.py b/apps/acls/serializers/rules/rules.py index 80316147e..85b865cd6 100644 --- a/apps/acls/serializers/rules/rules.py +++ b/apps/acls/serializers/rules/rules.py @@ -22,7 +22,7 @@ def ip_group_child_validator(ip_group_child): ip_group_help_text = _( - 'Format for comma-delimited string, with * indicating a match all. ' + 'With * indicating a match all. ' 'Such as: ' '192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 ' ) diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index 44722ec8e..b55f21643 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa23f3e706ba260d6f8123488e5a35b46a2d746ac35249f2b0b6bad042c75066 -size 138642 +oid sha256:a4ef9ccfeccf8f45c8753bc901ff6efe970486565c3bcf2d46042657ffa49f42 +size 139618 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index d95ccb443..1aee33de2 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-19 12:58+0800\n" +"POT-Creation-Date: 2023-04-20 17:31+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -68,7 +68,7 @@ msgstr "ローカル" #: accounts/const/account.py:20 msgid "Collected" -msgstr "" +msgstr "集めました" #: accounts/const/account.py:21 accounts/serializers/account/account.py:25 #: settings/serializers/auth/sms.py:75 @@ -204,7 +204,7 @@ msgid "Su from" msgstr "から切り替え" #: accounts/models/account.py:53 settings/serializers/auth/cas.py:20 -#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:28 +#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:29 msgid "Version" msgstr "バージョン" @@ -214,10 +214,8 @@ msgid "Source" msgstr "ソース" #: accounts/models/account.py:56 -#, fuzzy -#| msgid "Source" msgid "Source ID" -msgstr "ソース" +msgstr "ソース ID" #: accounts/models/account.py:59 #: accounts/serializers/automations/change_secret.py:113 @@ -445,10 +443,8 @@ msgid "Gather account automation" msgstr "自動収集アカウント" #: accounts/models/automations/gather_account.py:56 -#, fuzzy -#| msgid "Is service account" msgid "Is sync account" -msgstr "サービスアカウントです" +msgstr "アカウントを同期するかどうか" #: accounts/models/automations/gather_account.py:71 #: accounts/tasks/gather_accounts.py:29 @@ -489,7 +485,7 @@ msgstr "アカウントの確認" #: ops/models/job.py:92 ops/models/playbook.py:23 ops/serializers/job.py:20 #: orgs/models.py:69 perms/models/asset_permission.py:56 rbac/models/role.py:29 #: settings/models.py:33 settings/serializers/sms.py:6 -#: terminal/models/applet/applet.py:26 terminal/models/component/endpoint.py:12 +#: terminal/models/applet/applet.py:27 terminal/models/component/endpoint.py:12 #: terminal/models/component/endpoint.py:90 #: terminal/models/component/storage.py:26 terminal/models/component/task.py:15 #: terminal/models/component/terminal.py:84 users/forms/profile.py:33 @@ -506,7 +502,7 @@ msgstr "特権アカウント" #: assets/models/automations/base.py:21 assets/models/cmd_filter.py:39 #: assets/models/label.py:22 #: authentication/serializers/connect_token_secret.py:106 -#: terminal/models/applet/applet.py:31 users/serializers/user.py:169 +#: terminal/models/applet/applet.py:32 users/serializers/user.py:169 msgid "Is active" msgstr "アクティブです。" @@ -556,10 +552,8 @@ msgid "Push now" msgstr "今すぐプッシュ" #: accounts/serializers/account/account.py:35 -#, fuzzy -#| msgid "Runas policy" msgid "Exist policy" -msgstr "ユーザー ポリシー" +msgstr "アカウントの存在ポリシー" #: accounts/serializers/account/account.py:179 applications/models.py:11 #: assets/models/label.py:21 assets/models/platform.py:90 @@ -578,7 +572,7 @@ msgstr "カテゴリ" #: assets/serializers/asset/common.py:121 assets/serializers/platform.py:101 #: assets/serializers/platform.py:116 audits/serializers.py:48 #: authentication/serializers/connect_token_secret.py:115 ops/models/job.py:103 -#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:30 +#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31 #: terminal/models/component/storage.py:57 #: terminal/models/component/storage.py:146 terminal/serializers/applet.py:29 #: terminal/serializers/session.py:22 terminal/serializers/storage.py:224 @@ -606,10 +600,8 @@ msgid "State" msgstr "状態" #: accounts/serializers/account/account.py:235 -#, fuzzy -#| msgid "Change by" msgid "Changed" -msgstr "による変更" +msgstr "編集済み" #: accounts/serializers/account/account.py:241 #: accounts/serializers/automations/base.py:22 @@ -621,24 +613,26 @@ msgid "Assets" msgstr "資産" #: accounts/serializers/account/account.py:293 -#, fuzzy -#| msgid "Name already exists" msgid "Account already exists" -msgstr "名前は既に存在します。" +msgstr "アカウントはすでに存在しています" #: accounts/serializers/account/account.py:330 -#, fuzzy, python-format -#| msgid "Current user not support mfa type: {}" +#, python-format msgid "Asset does not support this secret type: %s" -msgstr "現在のユーザーはmfaタイプをサポートしていません: {}" +msgstr "アセットはアカウント タイプをサポートしていません: %s" #: accounts/serializers/account/account.py:361 -#, fuzzy -#| msgid "Account name" msgid "Account has exist" -msgstr "アカウント名" +msgstr "アカウントはすでに存在しています" -#: accounts/serializers/account/account.py:401 acls/models/base.py:98 +#: accounts/serializers/account/account.py:395 +#: authentication/serializers/connect_token_secret.py:146 +#: authentication/templates/authentication/_access_key_modal.html:30 +#: perms/models/perm_node.py:21 users/serializers/group.py:33 +msgid "ID" +msgstr "ID" + +#: accounts/serializers/account/account.py:402 acls/models/base.py:98 #: acls/models/login_acl.py:13 acls/serializers/base.py:55 #: acls/serializers/login_acl.py:21 assets/models/cmd_filter.py:24 #: assets/models/label.py:16 audits/models.py:44 audits/models.py:63 @@ -656,7 +650,7 @@ msgstr "アカウント名" msgid "User" msgstr "ユーザー" -#: accounts/serializers/account/account.py:402 +#: accounts/serializers/account/account.py:403 #: authentication/templates/authentication/_access_key_modal.html:33 #: terminal/notifications.py:98 terminal/notifications.py:146 msgid "Date" @@ -879,18 +873,18 @@ msgid "Login asset confirm" msgstr "ログイン資産の確認" #: acls/serializers/base.py:10 acls/serializers/login_acl.py:16 -msgid "Format for comma-delimited string, with * indicating a match all. " -msgstr "コンマ区切り文字列の形式。* はすべて一致することを示します。" +msgid "With * indicating a match all. " +msgstr "* はすべて一致することを示します。" #: acls/serializers/base.py:25 msgid "" -"Format for comma-delimited string, with * indicating a match all. Such as: " -"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" -"db8:1a:1110::/64 (Domain name support)" +"With * indicating a match all. Such as: 192.168.10.1, 192.168.1.0/24, " +"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (Domain name " +"support)" msgstr "" -"コンマ区切り文字列の形式。* はすべて一致することを示します。例: " -"192.168.10.1、192.168.1.0/24、10.1.1.1-10.1.1.20、2001:db8:2de::e13、2001:" -"db8:1a:1110:::/64 (ドメイン名サポート)" +"* はすべて一致することを示します。例: 192.168.10.1、192.168.1.0/24、" +"10.1.1.1-10.1.1.20、2001:db8:2de::e13、2001:db8:1a:1110:::/64 (ドメイン名サ" +"ポート)" #: acls/serializers/base.py:40 assets/serializers/asset/host.py:19 msgid "IP/Host" @@ -935,13 +929,11 @@ msgstr "IPアドレスが無効: '{}'" #: acls/serializers/rules/rules.py:25 msgid "" -"Format for comma-delimited string, with * indicating a match all. Such as: " -"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" -"db8:1a:1110::/64 " +"With * indicating a match all. Such as: 192.168.10.1, 192.168.1.0/24, " +"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 " msgstr "" -"コンマ区切り文字列の形式。* はすべて一致することを示します。例: " -"192.168.10.1、192.168.1.0/24、10.1.1.1-10.1.1.20、2001:db8:2de::e13、2001:" -"db8:1a:1110::/64" +"* はすべて一致することを示します。例: 192.168.10.1、192.168.1.0/24、" +"10.1.1.1-10.1.1.20、2001:db8:2de::e13、2001:db8:1a:1110::/64" #: acls/serializers/rules/rules.py:33 #: authentication/templates/authentication/_msg_oauth_bind.html:12 @@ -1069,15 +1061,13 @@ msgid "Cloud service" msgstr "クラウド サービス" #: assets/const/category.py:14 assets/models/asset/web.py:16 audits/const.py:33 -#: terminal/models/applet/applet.py:24 +#: terminal/models/applet/applet.py:25 msgid "Web" msgstr "Web" #: assets/const/category.py:15 -#, fuzzy -#| msgid "Custom user" msgid "Custom type" -msgstr "カスタムユーザー" +msgstr "カスタムタイプ" #: assets/const/cloud.py:7 msgid "Public cloud" @@ -1091,7 +1081,7 @@ msgstr "私有雲" msgid "Kubernetes" msgstr "" -#: assets/const/device.py:7 terminal/models/applet/applet.py:23 +#: assets/const/device.py:7 terminal/models/applet/applet.py:24 #: tickets/const.py:8 msgid "General" msgstr "一般" @@ -1150,7 +1140,7 @@ msgstr "SSHパブリックキー" #: assets/models/cmd_filter.py:88 assets/models/group.py:23 #: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:111 #: ops/models/playbook.py:26 rbac/models/role.py:37 settings/models.py:38 -#: terminal/models/applet/applet.py:35 terminal/models/applet/applet.py:183 +#: terminal/models/applet/applet.py:36 terminal/models/applet/applet.py:184 #: terminal/models/applet/host.py:111 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 @@ -1200,7 +1190,7 @@ msgstr "ユーザーと同じユーザー名" #: assets/models/_user.py:52 authentication/models/connection_token.py:39 #: authentication/serializers/connect_token_secret.py:103 -#: terminal/models/applet/applet.py:33 terminal/serializers/session.py:20 +#: terminal/models/applet/applet.py:34 terminal/serializers/session.py:20 #: terminal/serializers/session.py:41 terminal/serializers/storage.py:68 msgid "Protocol" msgstr "プロトコル" @@ -1266,7 +1256,7 @@ msgstr "アドレス" #: assets/models/asset/common.py:125 assets/models/platform.py:120 #: authentication/serializers/connect_token_secret.py:107 #: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:197 +#: xpack/plugins/cloud/serializers/account_attrs.py:196 msgid "Platform" msgstr "プラットフォーム" @@ -1282,17 +1272,13 @@ msgstr "ラベル" #: assets/models/asset/common.py:132 assets/serializers/asset/common.py:305 #: assets/serializers/asset/host.py:11 -#, fuzzy -#| msgid "Gather asset hardware info" msgid "Gathered info" msgstr "資産ハードウェア情報の収集" #: assets/models/asset/common.py:133 assets/serializers/asset/custom.py:14 #: assets/serializers/asset/custom.py:22 -#, fuzzy -#| msgid "Auto info" msgid "Custom info" -msgstr "自動情報" +msgstr "自动化信息" #: assets/models/asset/common.py:309 msgid "Can refresh asset hardware info" @@ -1311,10 +1297,8 @@ msgid "Can change asset nodes" msgstr "資産ノードを変更できます" #: assets/models/asset/custom.py:8 -#, fuzzy -#| msgid "Custom user" msgid "Custom asset" -msgstr "カスタムユーザー" +msgstr "カスタム アセット" #: assets/models/asset/database.py:10 assets/serializers/platform.py:45 #: settings/serializers/email.py:37 @@ -1372,7 +1356,7 @@ msgstr "アセットの自動化タスク" #: assets/models/automations/base.py:113 audits/models.py:177 #: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:184 -#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:108 +#: terminal/models/applet/applet.py:183 terminal/models/applet/host.py:108 #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:103 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 @@ -1507,10 +1491,8 @@ msgid "Required" msgstr "必要" #: assets/models/platform.py:18 -#, fuzzy -#| msgid "Public IP" msgid "Public" -msgstr "パブリックIP" +msgstr "開ける" #: assets/models/platform.py:19 settings/serializers/settings.py:65 #: users/templates/users/reset_password.html:29 @@ -1658,7 +1640,7 @@ msgstr "ポート番号が範囲外です (1-65535)" msgid "Protocol is required: {}" msgstr "プロトコルが必要です: {}" -#: assets/serializers/asset/database.py:25 common/serializers/fields.py:102 +#: assets/serializers/asset/database.py:25 common/serializers/fields.py:103 #: tickets/serializers/ticket/common.py:58 #: xpack/plugins/cloud/serializers/account_attrs.py:56 #: xpack/plugins/cloud/serializers/account_attrs.py:79 @@ -1765,8 +1747,6 @@ msgid "Gather accounts method" msgstr "アカウントの収集方法" #: assets/serializers/platform.py:103 -#, fuzzy -#| msgid "Help" msgid "Help text" msgstr "ヘルプ" @@ -1783,16 +1763,12 @@ msgid "Default Domain" msgstr "デフォルト ドメイン" #: assets/serializers/platform.py:152 -#, fuzzy -#| msgid "test_phone is required" msgid "type is required" -msgstr "携帯番号をテストこのフィールドは必須です" +msgstr "タイプ このフィールドは必須です." #: assets/serializers/platform.py:189 -#, fuzzy -#| msgid "Protocol is required: {}" msgid "Protocols is required" -msgstr "プロトコルが必要です: {}" +msgstr "同意が必要です" #: assets/signal_handlers/asset.py:26 assets/tasks/ping.py:35 msgid "Test assets connectivity " @@ -2620,12 +2596,6 @@ msgstr "コンポーネント" msgid "Expired now" msgstr "すぐに期限切れ" -#: authentication/serializers/connect_token_secret.py:146 -#: authentication/templates/authentication/_access_key_modal.html:30 -#: perms/models/perm_node.py:21 users/serializers/group.py:33 -msgid "ID" -msgstr "ID" - #: authentication/serializers/connection_token.py:15 msgid "Expired time" msgstr "期限切れ時間" @@ -3051,7 +3021,7 @@ msgstr "未定" #: common/const/choices.py:17 ops/const.py:55 msgid "Running" -msgstr "" +msgstr "ランニング" #: common/const/choices.py:21 msgid "Canceled" @@ -3113,7 +3083,7 @@ msgstr "によって更新" #: common/db/validators.py:9 msgid "Invalid port range, should be like and within {}-{}" -msgstr "" +msgstr "無効なポート範囲です。{}-{} のような範囲内である必要があります" #: common/drf/exc_handlers.py:26 msgid "Object" @@ -3132,10 +3102,8 @@ msgid "Parse file error: {}" msgstr "解析ファイルエラー: {}" #: common/drf/parsers/excel.py:14 -#, fuzzy -#| msgid "Invalid zip file" msgid "Invalid excel file" -msgstr "zip ファイルが無効です" +msgstr "無効 excel 書類" #: common/exceptions.py:15 #, python-format @@ -3238,21 +3206,21 @@ msgstr "" msgid "File" msgstr "書類" -#: common/serializers/fields.py:103 +#: common/serializers/fields.py:104 #, python-brace-format msgid "Invalid pk \"{pk_value}\" - object does not exist." msgstr "無効な pk \"{pk_value}\" - オブジェクトが存在しません" -#: common/serializers/fields.py:104 +#: common/serializers/fields.py:105 #, python-brace-format msgid "Incorrect type. Expected pk value, received {data_type}." msgstr "エラータイプ。 予想される pk 値、受信 {data_type}。" -#: common/serializers/fields.py:174 +#: common/serializers/fields.py:179 msgid "Invalid data type, should be list" msgstr "間違ったデータ タイプです。リストにする必要があります" -#: common/serializers/fields.py:189 +#: common/serializers/fields.py:194 msgid "Invalid choice: {}" msgstr "無効なオプション: {}" @@ -3609,7 +3577,7 @@ msgstr "" msgid "Material Type" msgstr "" -#: ops/models/job.py:456 +#: ops/models/job.py:458 msgid "Job Execution" msgstr "ジョブ実行" @@ -3759,7 +3727,7 @@ msgstr "組織" msgid "Org name" msgstr "組織名" -#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:32 +#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:33 msgid "Builtin" msgstr "ビルトイン" @@ -4004,7 +3972,7 @@ msgstr "パーマ" msgid "Users amount" msgstr "ユーザー数" -#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:27 +#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:28 msgid "Display name" msgstr "表示名" @@ -4068,8 +4036,8 @@ msgstr "タスクセンター" msgid "My assets" msgstr "私の資産" -#: rbac/tree.py:56 terminal/models/applet/applet.py:42 -#: terminal/models/applet/applet.py:179 terminal/models/applet/host.py:28 +#: rbac/tree.py:56 terminal/models/applet/applet.py:43 +#: terminal/models/applet/applet.py:180 terminal/models/applet/host.py:28 #: terminal/serializers/applet.py:15 msgid "Applet" msgstr "リモートアプリケーション" @@ -4569,7 +4537,7 @@ msgid "SSO auth key TTL" msgstr "Token有効期間" #: settings/serializers/auth/sso.py:17 -#: xpack/plugins/cloud/serializers/account_attrs.py:194 +#: xpack/plugins/cloud/serializers/account_attrs.py:193 msgid "Unit: second" msgstr "単位: 秒" @@ -5603,35 +5571,35 @@ msgstr "一括作成非サポート" msgid "Storage is invalid" msgstr "ストレージが無効です" -#: terminal/models/applet/applet.py:29 +#: terminal/models/applet/applet.py:30 msgid "Author" msgstr "著者" -#: terminal/models/applet/applet.py:34 +#: terminal/models/applet/applet.py:35 msgid "Tags" msgstr "ラベル" -#: terminal/models/applet/applet.py:38 terminal/serializers/storage.py:157 +#: terminal/models/applet/applet.py:39 terminal/serializers/storage.py:157 msgid "Hosts" msgstr "ホスト" -#: terminal/models/applet/applet.py:83 +#: terminal/models/applet/applet.py:84 msgid "Applet pkg not valid, Missing file {}" msgstr "無効なアプレット パッケージ、ファイル {} がありません" -#: terminal/models/applet/applet.py:102 +#: terminal/models/applet/applet.py:103 msgid "Load platform.yml failed: {}" msgstr "" -#: terminal/models/applet/applet.py:105 +#: terminal/models/applet/applet.py:106 msgid "Only support custom platform" msgstr "" -#: terminal/models/applet/applet.py:110 +#: terminal/models/applet/applet.py:111 msgid "Missing type in platform.yml" msgstr "" -#: terminal/models/applet/applet.py:181 terminal/models/applet/host.py:34 +#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:34 #: terminal/models/applet/host.py:106 msgid "Hosting" msgstr "ホスト マシン" @@ -6735,10 +6703,8 @@ msgid "Avatar url" msgstr "アバターURL" #: users/serializers/user.py:177 -#, fuzzy -#| msgid "One level" msgid "MFA level" -msgstr "1つのレベル" +msgstr "MFA レベル" #: users/serializers/user.py:283 msgid "Select users" @@ -7166,7 +7132,7 @@ msgstr "クラウドアカウント" msgid "Test cloud account" msgstr "クラウドアカウントのテスト" -#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:37 +#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:36 msgid "Regions" msgstr "リージョン" @@ -7174,15 +7140,15 @@ msgstr "リージョン" msgid "Hostname strategy" msgstr "ホスト名戦略" -#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:40 +#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:39 msgid "IP network segment group" msgstr "IPネットワークセグメントグループ" -#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:45 +#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:44 msgid "Sync IP type" msgstr "同期IPタイプ" -#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:62 +#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:61 msgid "Always update" msgstr "常に更新" @@ -7468,12 +7434,10 @@ msgid "IP address invalid `{}`, {}" msgstr "IPアドレスが無効: '{}', {}" #: xpack/plugins/cloud/serializers/account_attrs.py:172 -msgid "" -"Format for comma-delimited string,Such as: 192.168.1.0/24, " -"10.0.0.0-10.0.0.255" -msgstr "形式はコンマ区切りの文字列です,例:192.168.1.0/24,10.0.0.0-10.0.0.255" +msgid "Such as: 192.168.1.0/24, 10.0.0.0-10.0.0.255" +msgstr "例:192.168.1.0/24,10.0.0.0-10.0.0.255" -#: xpack/plugins/cloud/serializers/account_attrs.py:176 +#: xpack/plugins/cloud/serializers/account_attrs.py:175 msgid "" "The port is used to detect the validity of the IP address. When the " "synchronization task is executed, only the valid IP address will be " @@ -7483,19 +7447,19 @@ msgstr "" "実行されると、有効な IP アドレスのみが同期されます。
ポートが0の場合、す" "べてのIPアドレスが有効です。" -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:183 msgid "Hostname prefix" msgstr "ホスト名プレフィックス" -#: xpack/plugins/cloud/serializers/account_attrs.py:187 +#: xpack/plugins/cloud/serializers/account_attrs.py:186 msgid "IP segment" msgstr "IP セグメント" -#: xpack/plugins/cloud/serializers/account_attrs.py:191 +#: xpack/plugins/cloud/serializers/account_attrs.py:190 msgid "Test port" msgstr "テストポート" -#: xpack/plugins/cloud/serializers/account_attrs.py:194 +#: xpack/plugins/cloud/serializers/account_attrs.py:193 msgid "Test timeout" msgstr "テストタイムアウト" @@ -7504,20 +7468,19 @@ msgid "" "Only instances matching the IP range will be synced.
If the instance " "contains multiple IP addresses, the first IP address that matches will be " "used as the IP for the created asset.
The default value of * means sync " -"all instances and randomly match IP addresses.
Format for comma-" -"delimited string, Such as: 192.168.1.0/24, 10.1.1.1-10.1.1.20" +"all instances and randomly match IP addresses.
Such as: 192.168.1.0/24, " +"10.1.1.1-10.1.1.20" msgstr "" "IP範囲に一致するインスタンスのみが同期されます。
インスタンスに複数のIPア" "ドレスが含まれている場合、一致する最初のIPアドレスが作成されたアセットのIPと" "して使用されます。
デフォルト値の*は、すべてのインスタンスを同期し、IPア" -"ドレスをランダムに一致させることを意味します。
形式はコンマ区切りの文字列" -"です。例:192.168.1.0/24,10.1.1.1-10.1.1.20" +"ドレスをランダムに一致させることを意味します。
例:192.168.1.0/24,10.1.1.1-10.1.1.20" -#: xpack/plugins/cloud/serializers/task.py:35 +#: xpack/plugins/cloud/serializers/task.py:34 msgid "History count" msgstr "実行回数" -#: xpack/plugins/cloud/serializers/task.py:36 +#: xpack/plugins/cloud/serializers/task.py:35 msgid "Instance count" msgstr "インスタンス数" @@ -7596,19 +7559,3 @@ msgstr "究極のエディション" #: xpack/plugins/license/models.py:86 msgid "Community edition" msgstr "コミュニティ版" - -#, fuzzy -#~| msgid "Parameters" -#~ msgid "Params" -#~ msgstr "パラメータ" - -#~ msgid "Auto fill" -#~ msgstr "自動充填" - -#~ msgid "Info" -#~ msgstr "情報" - -#, fuzzy -#~| msgid "Custom user" -#~ msgid "Custom" -#~ msgstr "カスタムユーザー" diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 7ae1a2fb3..a4ec5564d 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb1b9a1cb886205fdd2320ddad5b3dea2e3bc15a76173ee0eab38c9c7b83739f -size 114597 +oid sha256:2dd0610d610c2660f35d50dc2871ac08cc09080d2503e1080a57d97c47fea471 +size 114418 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index b67a23cff..4d3396700 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-19 12:58+0800\n" +"POT-Creation-Date: 2023-04-20 17:31+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -203,7 +203,7 @@ msgid "Su from" msgstr "切换自" #: accounts/models/account.py:53 settings/serializers/auth/cas.py:20 -#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:28 +#: settings/serializers/auth/feishu.py:20 terminal/models/applet/applet.py:29 msgid "Version" msgstr "版本" @@ -484,7 +484,7 @@ msgstr "账号验证" #: ops/models/job.py:92 ops/models/playbook.py:23 ops/serializers/job.py:20 #: orgs/models.py:69 perms/models/asset_permission.py:56 rbac/models/role.py:29 #: settings/models.py:33 settings/serializers/sms.py:6 -#: terminal/models/applet/applet.py:26 terminal/models/component/endpoint.py:12 +#: terminal/models/applet/applet.py:27 terminal/models/component/endpoint.py:12 #: terminal/models/component/endpoint.py:90 #: terminal/models/component/storage.py:26 terminal/models/component/task.py:15 #: terminal/models/component/terminal.py:84 users/forms/profile.py:33 @@ -501,7 +501,7 @@ msgstr "特权账号" #: assets/models/automations/base.py:21 assets/models/cmd_filter.py:39 #: assets/models/label.py:22 #: authentication/serializers/connect_token_secret.py:106 -#: terminal/models/applet/applet.py:31 users/serializers/user.py:169 +#: terminal/models/applet/applet.py:32 users/serializers/user.py:169 msgid "Is active" msgstr "激活" @@ -568,7 +568,7 @@ msgstr "类别" #: assets/serializers/asset/common.py:121 assets/serializers/platform.py:101 #: assets/serializers/platform.py:116 audits/serializers.py:48 #: authentication/serializers/connect_token_secret.py:115 ops/models/job.py:103 -#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:30 +#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31 #: terminal/models/component/storage.py:57 #: terminal/models/component/storage.py:146 terminal/serializers/applet.py:29 #: terminal/serializers/session.py:22 terminal/serializers/storage.py:224 @@ -621,7 +621,14 @@ msgstr "资产不支持账号类型: %s" msgid "Account has exist" msgstr "账号已存在" -#: accounts/serializers/account/account.py:401 acls/models/base.py:98 +#: accounts/serializers/account/account.py:395 +#: authentication/serializers/connect_token_secret.py:146 +#: authentication/templates/authentication/_access_key_modal.html:30 +#: perms/models/perm_node.py:21 users/serializers/group.py:33 +msgid "ID" +msgstr "ID" + +#: accounts/serializers/account/account.py:402 acls/models/base.py:98 #: acls/models/login_acl.py:13 acls/serializers/base.py:55 #: acls/serializers/login_acl.py:21 assets/models/cmd_filter.py:24 #: assets/models/label.py:16 audits/models.py:44 audits/models.py:63 @@ -639,7 +646,7 @@ msgstr "账号已存在" msgid "User" msgstr "用户" -#: accounts/serializers/account/account.py:402 +#: accounts/serializers/account/account.py:403 #: authentication/templates/authentication/_access_key_modal.html:33 #: terminal/notifications.py:98 terminal/notifications.py:146 msgid "Date" @@ -862,17 +869,17 @@ msgid "Login asset confirm" msgstr "登录资产复核" #: acls/serializers/base.py:10 acls/serializers/login_acl.py:16 -msgid "Format for comma-delimited string, with * indicating a match all. " -msgstr "格式为逗号分隔的字符串, * 表示匹配所有. " +msgid "With * indicating a match all. " +msgstr "* 表示匹配所有. " #: acls/serializers/base.py:25 msgid "" -"Format for comma-delimited string, with * indicating a match all. Such as: " -"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" -"db8:1a:1110::/64 (Domain name support)" +"With * indicating a match all. Such as: 192.168.10.1, 192.168.1.0/24, " +"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (Domain name " +"support)" msgstr "" -"格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " -"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)" +"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:" +"db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)" #: acls/serializers/base.py:40 assets/serializers/asset/host.py:19 msgid "IP/Host" @@ -917,12 +924,11 @@ msgstr "IP 地址无效: `{}`" #: acls/serializers/rules/rules.py:25 msgid "" -"Format for comma-delimited string, with * indicating a match all. Such as: " -"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" -"db8:1a:1110::/64 " +"With * indicating a match all. Such as: 192.168.10.1, 192.168.1.0/24, " +"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 " msgstr "" -"格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " -"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64" +"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:" +"db8:2de::e13, 2001:db8:1a:1110::/64" #: acls/serializers/rules/rules.py:33 #: authentication/templates/authentication/_msg_oauth_bind.html:12 @@ -1048,7 +1054,7 @@ msgid "Cloud service" msgstr "云服务" #: assets/const/category.py:14 assets/models/asset/web.py:16 audits/const.py:33 -#: terminal/models/applet/applet.py:24 +#: terminal/models/applet/applet.py:25 msgid "Web" msgstr "Web" @@ -1068,7 +1074,7 @@ msgstr "私有云" msgid "Kubernetes" msgstr "" -#: assets/const/device.py:7 terminal/models/applet/applet.py:23 +#: assets/const/device.py:7 terminal/models/applet/applet.py:24 #: tickets/const.py:8 msgid "General" msgstr "一般" @@ -1127,7 +1133,7 @@ msgstr "SSH公钥" #: assets/models/cmd_filter.py:88 assets/models/group.py:23 #: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:111 #: ops/models/playbook.py:26 rbac/models/role.py:37 settings/models.py:38 -#: terminal/models/applet/applet.py:35 terminal/models/applet/applet.py:183 +#: terminal/models/applet/applet.py:36 terminal/models/applet/applet.py:184 #: terminal/models/applet/host.py:111 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 @@ -1177,7 +1183,7 @@ msgstr "用户名与用户相同" #: assets/models/_user.py:52 authentication/models/connection_token.py:39 #: authentication/serializers/connect_token_secret.py:103 -#: terminal/models/applet/applet.py:33 terminal/serializers/session.py:20 +#: terminal/models/applet/applet.py:34 terminal/serializers/session.py:20 #: terminal/serializers/session.py:41 terminal/serializers/storage.py:68 msgid "Protocol" msgstr "协议" @@ -1243,7 +1249,7 @@ msgstr "地址" #: assets/models/asset/common.py:125 assets/models/platform.py:120 #: authentication/serializers/connect_token_secret.py:107 #: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:197 +#: xpack/plugins/cloud/serializers/account_attrs.py:196 msgid "Platform" msgstr "系统平台" @@ -1343,7 +1349,7 @@ msgstr "资产自动化任务" #: assets/models/automations/base.py:113 audits/models.py:177 #: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:184 -#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:108 +#: terminal/models/applet/applet.py:183 terminal/models/applet/host.py:108 #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:103 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 @@ -1625,7 +1631,7 @@ msgstr "端口超出范围 (1-65535)" msgid "Protocol is required: {}" msgstr "协议是必填的: {}" -#: assets/serializers/asset/database.py:25 common/serializers/fields.py:102 +#: assets/serializers/asset/database.py:25 common/serializers/fields.py:103 #: tickets/serializers/ticket/common.py:58 #: xpack/plugins/cloud/serializers/account_attrs.py:56 #: xpack/plugins/cloud/serializers/account_attrs.py:79 @@ -1732,8 +1738,6 @@ msgid "Gather accounts method" msgstr "收集账号方式" #: assets/serializers/platform.py:103 -#, fuzzy -#| msgid "Help" msgid "Help text" msgstr "帮助" @@ -1973,7 +1977,7 @@ msgstr "详情 ID" #: audits/models.py:130 msgid "Activity log" -msgstr "" +msgstr "活动日志" #: audits/models.py:142 msgid "Change by" @@ -2569,12 +2573,6 @@ msgstr "组件" msgid "Expired now" msgstr "立刻过期" -#: authentication/serializers/connect_token_secret.py:146 -#: authentication/templates/authentication/_access_key_modal.html:30 -#: perms/models/perm_node.py:21 users/serializers/group.py:33 -msgid "ID" -msgstr "ID" - #: authentication/serializers/connection_token.py:15 msgid "Expired time" msgstr "过期时间" @@ -3177,21 +3175,21 @@ msgstr "节点" msgid "File" msgstr "文件" -#: common/serializers/fields.py:103 +#: common/serializers/fields.py:104 #, python-brace-format msgid "Invalid pk \"{pk_value}\" - object does not exist." msgstr "错误的 pk \"{pk_value}\" - 对象不存在" -#: common/serializers/fields.py:104 +#: common/serializers/fields.py:105 #, python-brace-format msgid "Incorrect type. Expected pk value, received {data_type}." msgstr "错误类型。期望 pk 值,收到 {data_type}。" -#: common/serializers/fields.py:174 +#: common/serializers/fields.py:179 msgid "Invalid data type, should be list" msgstr "错误的数据类型,应该是列表" -#: common/serializers/fields.py:189 +#: common/serializers/fields.py:194 msgid "Invalid choice: {}" msgstr "无效选项: {}" @@ -3543,7 +3541,7 @@ msgstr "" msgid "Material Type" msgstr "" -#: ops/models/job.py:456 +#: ops/models/job.py:458 msgid "Job Execution" msgstr "作业执行" @@ -3692,7 +3690,7 @@ msgstr "组织" msgid "Org name" msgstr "组织名称" -#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:32 +#: orgs/models.py:70 rbac/models/role.py:36 terminal/models/applet/applet.py:33 msgid "Builtin" msgstr "内置的" @@ -3936,7 +3934,7 @@ msgstr "权限" msgid "Users amount" msgstr "用户数量" -#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:27 +#: rbac/serializers/role.py:28 terminal/models/applet/applet.py:28 msgid "Display name" msgstr "显示名称" @@ -4000,8 +3998,8 @@ msgstr "任务中心" msgid "My assets" msgstr "我的资产" -#: rbac/tree.py:56 terminal/models/applet/applet.py:42 -#: terminal/models/applet/applet.py:179 terminal/models/applet/host.py:28 +#: rbac/tree.py:56 terminal/models/applet/applet.py:43 +#: terminal/models/applet/applet.py:180 terminal/models/applet/host.py:28 #: terminal/serializers/applet.py:15 msgid "Applet" msgstr "远程应用" @@ -4499,7 +4497,7 @@ msgid "SSO auth key TTL" msgstr "令牌有效期" #: settings/serializers/auth/sso.py:17 -#: xpack/plugins/cloud/serializers/account_attrs.py:194 +#: xpack/plugins/cloud/serializers/account_attrs.py:193 msgid "Unit: second" msgstr "单位: 秒" @@ -5500,35 +5498,35 @@ msgstr "不支持批量创建" msgid "Storage is invalid" msgstr "存储无效" -#: terminal/models/applet/applet.py:29 +#: terminal/models/applet/applet.py:30 msgid "Author" msgstr "作者" -#: terminal/models/applet/applet.py:34 +#: terminal/models/applet/applet.py:35 msgid "Tags" msgstr "标签" -#: terminal/models/applet/applet.py:38 terminal/serializers/storage.py:157 +#: terminal/models/applet/applet.py:39 terminal/serializers/storage.py:157 msgid "Hosts" msgstr "主机" -#: terminal/models/applet/applet.py:83 +#: terminal/models/applet/applet.py:84 msgid "Applet pkg not valid, Missing file {}" msgstr "Applet pkg 无效,缺少文件 {}" -#: terminal/models/applet/applet.py:102 +#: terminal/models/applet/applet.py:103 msgid "Load platform.yml failed: {}" msgstr "" -#: terminal/models/applet/applet.py:105 +#: terminal/models/applet/applet.py:106 msgid "Only support custom platform" msgstr "" -#: terminal/models/applet/applet.py:110 +#: terminal/models/applet/applet.py:111 msgid "Missing type in platform.yml" msgstr "" -#: terminal/models/applet/applet.py:181 terminal/models/applet/host.py:34 +#: terminal/models/applet/applet.py:182 terminal/models/applet/host.py:34 #: terminal/models/applet/host.py:106 msgid "Hosting" msgstr "宿主机" @@ -6033,7 +6031,7 @@ msgstr "打开" #: tickets/const.py:18 tickets/const.py:31 msgid "Reopen" -msgstr "" +msgstr "重新打开" #: tickets/const.py:19 tickets/const.py:32 msgid "Approved" @@ -7037,7 +7035,7 @@ msgstr "云账号" msgid "Test cloud account" msgstr "测试云账号" -#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:37 +#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:36 msgid "Regions" msgstr "地域" @@ -7045,15 +7043,15 @@ msgstr "地域" msgid "Hostname strategy" msgstr "主机名策略" -#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:40 +#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:39 msgid "IP network segment group" msgstr "IP网段组" -#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:45 +#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:44 msgid "Sync IP type" msgstr "同步IP类型" -#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:62 +#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:61 msgid "Always update" msgstr "总是更新" @@ -7339,12 +7337,10 @@ msgid "IP address invalid `{}`, {}" msgstr "IP 地址无效: `{}`, {}" #: xpack/plugins/cloud/serializers/account_attrs.py:172 -msgid "" -"Format for comma-delimited string,Such as: 192.168.1.0/24, " -"10.0.0.0-10.0.0.255" -msgstr "格式为逗号分隔的字符串,如:192.168.1.0/24,10.0.0.0-10.0.0.255" +msgid "Such as: 192.168.1.0/24, 10.0.0.0-10.0.0.255" +msgstr "如:192.168.1.0/24,10.0.0.0-10.0.0.255" -#: xpack/plugins/cloud/serializers/account_attrs.py:176 +#: xpack/plugins/cloud/serializers/account_attrs.py:175 msgid "" "The port is used to detect the validity of the IP address. When the " "synchronization task is executed, only the valid IP address will be " @@ -7353,19 +7349,19 @@ msgstr "" "端口用来检测 IP 地址的有效性,在同步任务执行时,只会同步有效的 IP 地址。
" "如果端口为 0,则表示所有 IP 地址均有效。" -#: xpack/plugins/cloud/serializers/account_attrs.py:184 +#: xpack/plugins/cloud/serializers/account_attrs.py:183 msgid "Hostname prefix" msgstr "主机名前缀" -#: xpack/plugins/cloud/serializers/account_attrs.py:187 +#: xpack/plugins/cloud/serializers/account_attrs.py:186 msgid "IP segment" msgstr "IP 网段" -#: xpack/plugins/cloud/serializers/account_attrs.py:191 +#: xpack/plugins/cloud/serializers/account_attrs.py:190 msgid "Test port" msgstr "测试端口" -#: xpack/plugins/cloud/serializers/account_attrs.py:194 +#: xpack/plugins/cloud/serializers/account_attrs.py:193 msgid "Test timeout" msgstr "测试超时时间" @@ -7374,18 +7370,18 @@ msgid "" "Only instances matching the IP range will be synced.
If the instance " "contains multiple IP addresses, the first IP address that matches will be " "used as the IP for the created asset.
The default value of * means sync " -"all instances and randomly match IP addresses.
Format for comma-" -"delimited string, Such as: 192.168.1.0/24, 10.1.1.1-10.1.1.20" +"all instances and randomly match IP addresses.
Such as: 192.168.1.0/24, " +"10.1.1.1-10.1.1.20" msgstr "" "只有匹配到 IP 段的实例会被同步。
如果实例包含多个 IP 地址,那么第一个匹配" "到的 IP 地址将被用作创建的资产的 IP。
默认值 * 表示同步所有实例和随机匹配 " -"IP 地址。
格式为以逗号分隔的字符串,例如:192.168.1.0/24,10.1.1.1-10.1.1.20" +"IP 地址。
例如:192.168.1.0/24,10.1.1.1-10.1.1.20" -#: xpack/plugins/cloud/serializers/task.py:35 +#: xpack/plugins/cloud/serializers/task.py:34 msgid "History count" msgstr "执行次数" -#: xpack/plugins/cloud/serializers/task.py:36 +#: xpack/plugins/cloud/serializers/task.py:35 msgid "Instance count" msgstr "实例个数" @@ -7464,109 +7460,3 @@ msgstr "旗舰版" #: xpack/plugins/license/models.py:86 msgid "Community edition" msgstr "社区版" - -#~ msgid "Auto fill" -#~ msgstr "自动代填" - -#~ msgid "Info" -#~ msgstr "信息" - -#, fuzzy -#~| msgid "Custom user" -#~ msgid "Custom" -#~ msgstr "自定义用户" - -#~ msgid "API Server" -#~ msgstr "API 服务" - -#~ msgid "Unix admin user" -#~ msgstr "Unix 管理员" - -#~ msgid "Windows admin user" -#~ msgstr "Windows 管理员" - -#~ msgid "Linux admin user" -#~ msgstr "Linux 管理员" - -#~ msgid "Can push account to asset" -#~ msgstr "可以推送账号到资产" - -#~ msgid "Add asset to node" -#~ msgstr "添加资产到节点" - -#~ msgid "Move asset to node" -#~ msgstr "移动资产到节点" - -#~ msgid "Remove asset from node" -#~ msgstr "从节点移除资产" - -#~ msgid "Clean audits log" -#~ msgstr "清理审计日志" - -#~ msgid "" -#~ "Typically, the port is 9000,the HTTP interface and the native interface " -#~ "use different ports" -#~ msgstr "默认端口为9000, HTTP接口和本机接口使用不同的端口" - -#~ msgid "CMD" -#~ msgstr "CMD" - -#~ msgid "PowerShell" -#~ msgstr "PowerShell" - -#~ msgid "Shell (Windows)" -#~ msgstr "Windows shell" - -#~ msgid "The shell type used when Windows assets perform ansible tasks" -#~ msgstr "windows 资产执行 Ansible 任务时,使用的 Shell 类型。" - -#~ msgid "Can change asset account secret" -#~ msgstr "可以更改资产账号密码" - -#~ msgid "Periodic clear celery tasks" -#~ msgstr "周期清理不可用任务" - -#~ msgid "Clean celery log period" -#~ msgstr "定期清除任务日志" - -#~ msgid "Periodic clean expired session" -#~ msgstr "周期清理过期会话" - -#~ msgid "AdHoc" -#~ msgstr "任务各版本" - -#~ msgid "Terminal ID" -#~ msgstr "终端 ID" - -#~ msgid "{} used account[{}], login method[{}] login the asset." -#~ msgstr "{} 使用账户[{}], 登录方式[{}]登录了这个资产." - -#~ msgid "User {} has executed change auth plan for this account.({})" -#~ msgstr "用户 {} 为这个账号执行了改密计划.({})" - -#~ msgid "User {} login into this service.[{}]" -#~ msgstr "用户 {} 登录了服务.[{}]" - -#~ msgid "Update some assets hardware info. " -#~ msgstr "更新资产硬件信息. " - -#~ msgid "Manually update the hardware information of assets" -#~ msgstr "手动更新资产信息" - -#~ msgid "Manually update the hardware information of assets under a node" -#~ msgstr "手动更新节点下资产信息" - -#~ msgid "Manually test the connectivity of a asset" -#~ msgstr "手动测试资产连接性" - -#~ msgid "Manually test the connectivity of assets under a node" -#~ msgstr "手动测试节点下资产连接性" - -#~ msgid "Disk info" -#~ msgstr "硬盘信息" - -#~ msgid "Hostname raw" -#~ msgstr "主机名原始" - -#~ msgid "Asset number" -#~ msgstr "资产编号"