From 30e51e37be72fb90d763f250599ab55048a7d03d Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:46:28 +0800 Subject: [PATCH 01/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8D=8E?= =?UTF-8?q?=E4=B8=BA=20SMS=20=E6=8F=90=E7=A4=BA=E4=B8=8D=E5=8F=8B=E5=A5=BD?= =?UTF-8?q?=20(#9643)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aaron3S --- apps/common/sdk/sms/huawei.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/common/sdk/sms/huawei.py b/apps/common/sdk/sms/huawei.py index c5d6bb116..d2243058d 100644 --- a/apps/common/sdk/sms/huawei.py +++ b/apps/common/sdk/sms/huawei.py @@ -86,8 +86,11 @@ class HuaweiSMS(BaseSMSClient): except Exception as error: raise JMSException(code='response_bad', detail=error) - if resp_msg.get('code') != '000000': - raise JMSException(code='response_bad', detail=resp_msg) + resp_code = resp_msg.get('code', '') + resp_desc = resp_msg.get('description', '') + if resp_code != '000000': + raise JMSException(code='response_bad', + detail="{}:{},{}:{}".format("code", resp_code, "description", resp_desc)) return resp_msg From 995321cee949c1da0874b5f5899896e0ae2da60e Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:48:52 +0800 Subject: [PATCH 02/17] =?UTF-8?q?perf:=20=E5=B7=A5=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=B7=A8=E7=BB=84=E7=BB=87=20(#9644)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/tickets/api/ticket.py | 14 +++++++++++--- .../templates/tickets/ticket_approve_diff.html | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/tickets/api/ticket.py b/apps/tickets/api/ticket.py index 52c388cec..29163a342 100644 --- a/apps/tickets/api/ticket.py +++ b/apps/tickets/api/ticket.py @@ -2,13 +2,13 @@ # from rest_framework import viewsets from rest_framework.decorators import action -from rest_framework.response import Response from rest_framework.exceptions import MethodNotAllowed +from rest_framework.response import Response -from orgs.utils import tmp_to_root_org -from rbac.permissions import RBACPermission from common.api import CommonApiMixin from common.const.http import POST, PUT, PATCH +from orgs.utils import tmp_to_root_org +from rbac.permissions import RBACPermission from tickets import filters from tickets import serializers from tickets.models import ( @@ -40,6 +40,14 @@ class TicketViewSet(CommonApiMixin, viewsets.ModelViewSet): 'open': 'tickets.view_ticket', } + + def retrieve(self, request, *args, **kwargs): + instance = self.get_object() + with tmp_to_root_org(): + serializer = self.get_serializer(instance) + data = serializer.data + return Response(data) + def create(self, request, *args, **kwargs): raise MethodNotAllowed(self.action) diff --git a/apps/tickets/templates/tickets/ticket_approve_diff.html b/apps/tickets/templates/tickets/ticket_approve_diff.html index 8426b34ed..79aad6b5c 100644 --- a/apps/tickets/templates/tickets/ticket_approve_diff.html +++ b/apps/tickets/templates/tickets/ticket_approve_diff.html @@ -18,7 +18,6 @@ {% endfor %} {% endfor %} - {% endif %} From d246b9bb35159a1dd595aa2abbffdae6c3a27228 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 20 Feb 2023 17:24:13 +0800 Subject: [PATCH 03/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E7=A1=AC=E4=BB=B6=E4=BF=A1=E6=81=AF=E6=94=B6=E9=9B=86?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=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/assets/automations/gather_facts/manager.py | 2 +- apps/assets/serializers/asset/host.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/assets/automations/gather_facts/manager.py b/apps/assets/automations/gather_facts/manager.py index 877ce811c..5ec25cb17 100644 --- a/apps/assets/automations/gather_facts/manager.py +++ b/apps/assets/automations/gather_facts/manager.py @@ -24,7 +24,7 @@ class GatherFactsManager(BasePlaybookManager): asset = self.host_asset_mapper.get(host) if asset and info: for k, v in info.items(): - info[k] = v.strip() + info[k] = v.strip() if isinstance(v, str) else v asset.info = info asset.save() else: diff --git a/apps/assets/serializers/asset/host.py b/apps/assets/serializers/asset/host.py index dd8d3bc2f..10b06dc20 100644 --- a/apps/assets/serializers/asset/host.py +++ b/apps/assets/serializers/asset/host.py @@ -12,8 +12,7 @@ class HostInfoSerializer(serializers.Serializer): vendor = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Vendor')) model = serializers.CharField(max_length=54, required=False, allow_blank=True, label=_('Model')) sn = serializers.CharField(max_length=128, required=False, allow_blank=True, label=_('Serial number')) - - cpu_model = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('CPU model')) + cpu_model = serializers.ListField(child=serializers.CharField(max_length=64, allow_blank=True), required=False, label=_('CPU model')) cpu_count = serializers.IntegerField(required=False, label=_('CPU count')) cpu_cores = serializers.IntegerField(required=False, label=_('CPU cores')) cpu_vcpus = serializers.IntegerField(required=False, label=_('CPU vcpus')) From 8ab01931fb2ea2e9eeb58d7d3ab532942fb48716 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 20 Feb 2023 16:01:48 +0800 Subject: [PATCH 04/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dlogger.error?= =?UTF-8?q?=E5=A0=86=E6=A0=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/rbac/permissions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/rbac/permissions.py b/apps/rbac/permissions.py index 788c10a69..7cc35d370 100644 --- a/apps/rbac/permissions.py +++ b/apps/rbac/permissions.py @@ -97,10 +97,10 @@ class RBACPermission(permissions.DjangoModelPermissions): else: model_cls = queryset.model except AssertionError as e: - logger.error('Error get model cls: ', e) + logger.error(f'Error get model cls: {e}') model_cls = None except AttributeError as e: - logger.error('Error get model cls: ', e) + logger.error(f'Error get model cls: {e}') model_cls = None except Exception as e: logger.error('Error get model class: {} of {}'.format(e, view)) From e001003ed39d2fe4132c433e9aba9158564c904d Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 20 Feb 2023 17:54:10 +0800 Subject: [PATCH 05/17] =?UTF-8?q?perf:=20=E5=AE=8C=E5=96=84=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=9C=BA=E7=9A=84=E9=87=8D=E5=A4=8D=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automations/deploy_applet_host/playbook.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/terminal/automations/deploy_applet_host/playbook.yml b/apps/terminal/automations/deploy_applet_host/playbook.yml index 73e0e6c09..4185f3ba1 100644 --- a/apps/terminal/automations/deploy_applet_host/playbook.yml +++ b/apps/terminal/automations/deploy_applet_host/playbook.yml @@ -30,6 +30,16 @@ include_management_tools: yes register: rds_install + - name: Stop Tinker before install (jumpserver) + ansible.windows.win_powershell: + script: | + if (Get-Service -Name 'JumpServer Tinker' -ErrorAction SilentlyContinue) { + Stop-Service -Name 'JumpServer Tinker' -Force + } + else { + $Ansible.Changed = $false + } + - name: Download JumpServer Tinker installer (jumpserver) ansible.windows.win_get_url: url: "{{ APPLET_DOWNLOAD_HOST }}/download/applets/{{ TinkerInstaller }}" @@ -44,7 +54,7 @@ - /NORESTART state: present - - name: Set remote-server on the global system path (remote-server) + - name: Set Tinkerd on the global system path (jumpserver) ansible.windows.win_path: elements: - '%USERPROFILE%\AppData\Local\Programs\Tinker\' From 958122847b4dcf2d74cc2fb5ee418da6401204b9 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Mon, 20 Feb 2023 16:57:57 +0800 Subject: [PATCH 06/17] =?UTF-8?q?fix:=20=E4=BD=9C=E4=B8=9A=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=90=9C=E7=B4=A2=E8=BF=87=E6=BB=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/audits/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/audits/api.py b/apps/audits/api.py index 601de6d5b..e1aff002a 100644 --- a/apps/audits/api.py +++ b/apps/audits/api.py @@ -30,6 +30,7 @@ class JobAuditViewSet(OrgReadonlyModelViewSet): ('date_start', ('date_from', 'date_to')) ] search_fields = ['creator__name', 'material'] + filterset_fields = ['creator__name', 'material'] serializer_class = JobLogSerializer ordering = ['-date_start'] From 2adfbeaeb76de3d6d30fbe31f6fd8ed1c16d6544 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 20 Feb 2023 18:41:46 +0800 Subject: [PATCH 07/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/api/component/terminal.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/terminal/api/component/terminal.py b/apps/terminal/api/component/terminal.py index d877be1df..6d4c141d1 100644 --- a/apps/terminal/api/component/terminal.py +++ b/apps/terminal/api/component/terminal.py @@ -1,13 +1,15 @@ # -*- coding: utf-8 -*- # import logging - +from django.db.models import Q from django.conf import settings from django.utils.translation import gettext_lazy as _ from rest_framework import generics from rest_framework import status from rest_framework.views import APIView, Response +from django_filters import rest_framework as filters +from common.drf.filters import BaseFilterSet from common.api import JMSBulkModelViewSet from common.exceptions import JMSException from common.permissions import WithBootstrapToken @@ -21,10 +23,28 @@ __all__ = [ logger = logging.getLogger(__file__) +class TerminalFilterSet(BaseFilterSet): + name = filters.CharFilter(field_name='name', lookup_expr='icontains') + remote_addr = filters.CharFilter(field_name='remote_addr', lookup_expr='icontains') + + class Meta: + model = Terminal + fields = ['name', 'remote_addr', 'type'] + + def filter_queryset(self, queryset): + queryset = super().filter_queryset(queryset) + search = self.request.query_params.get('search') + if not search: + return queryset + q = Q(name__icontains=search) | Q(remote_addr__icontains=search) + queryset = queryset.filter(q) + return queryset + + class TerminalViewSet(JMSBulkModelViewSet): queryset = Terminal.objects.filter(is_deleted=False) serializer_class = serializers.TerminalSerializer - filterset_fields = ['name', 'remote_addr', 'type'] + filterset_class = TerminalFilterSet custom_filter_fields = ['load'] def destroy(self, request, *args, **kwargs): From 95eeeb420803104fd119c49801c6af811c2ded48 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 19:12:57 +0800 Subject: [PATCH 08/17] =?UTF-8?q?perf:=20=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E8=84=B1=E6=95=8F=20aix=20(#9652)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- .../change_secret/host/aix/main.yml | 54 +++++++++++++++++++ .../change_secret/host/aix/manifest.yml | 6 +++ apps/assets/automations/base/manager.py | 26 +++++++++ apps/assets/const/host.py | 8 ++- apps/ops/signal_handlers.py | 3 +- 5 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 apps/accounts/automations/change_secret/host/aix/main.yml create mode 100644 apps/accounts/automations/change_secret/host/aix/manifest.yml diff --git a/apps/accounts/automations/change_secret/host/aix/main.yml b/apps/accounts/automations/change_secret/host/aix/main.yml new file mode 100644 index 000000000..cca9d681b --- /dev/null +++ b/apps/accounts/automations/change_secret/host/aix/main.yml @@ -0,0 +1,54 @@ +- hosts: demo + gather_facts: no + tasks: + - name: Test privileged account + ansible.builtin.ping: + + - name: Change password + ansible.builtin.user: + name: "{{ account.username }}" + password: "{{ account.secret | password_hash('des') }}" + update_password: always + when: secret_type == "password" + + - name: create user If it already exists, no operation will be performed + ansible.builtin.user: + name: "{{ account.username }}" + when: secret_type == "ssh_key" + + - name: remove jumpserver ssh key + ansible.builtin.lineinfile: + dest: "{{ kwargs.dest }}" + regexp: "{{ kwargs.regexp }}" + state: absent + when: + - secret_type == "ssh_key" + - kwargs.strategy == "set_jms" + + - name: Change SSH key + ansible.builtin.authorized_key: + user: "{{ account.username }}" + key: "{{ account.secret }}" + exclusive: "{{ kwargs.exclusive }}" + when: secret_type == "ssh_key" + + - name: Refresh connection + ansible.builtin.meta: reset_connection + + - name: Verify password + ansible.builtin.ping: + become: no + vars: + ansible_user: "{{ account.username }}" + ansible_password: "{{ account.secret }}" + ansible_become: no + when: secret_type == "password" + + - name: Verify SSH key + ansible.builtin.ping: + become: no + vars: + ansible_user: "{{ account.username }}" + ansible_ssh_private_key_file: "{{ account.private_key_path }}" + ansible_become: no + when: secret_type == "ssh_key" diff --git a/apps/accounts/automations/change_secret/host/aix/manifest.yml b/apps/accounts/automations/change_secret/host/aix/manifest.yml new file mode 100644 index 000000000..5c44f0350 --- /dev/null +++ b/apps/accounts/automations/change_secret/host/aix/manifest.yml @@ -0,0 +1,6 @@ +id: change_secret_aix +name: Change secret for aix +category: host +type: + - AIX +method: change_secret diff --git a/apps/assets/automations/base/manager.py b/apps/assets/automations/base/manager.py index 9c7ac4fd1..be4aa91fe 100644 --- a/apps/assets/automations/base/manager.py +++ b/apps/assets/automations/base/manager.py @@ -1,3 +1,4 @@ +import json import os import shutil from collections import defaultdict @@ -196,6 +197,30 @@ class BasePlaybookManager: def before_runner_start(self, runner): pass + @staticmethod + def delete_sensitive_data(path): + if settings.DEBUG_DEV: + return + + with open(path, 'r') as f: + d = json.load(f) + def delete_keys(d, keys_to_delete): + """ + 递归函数:删除嵌套字典中的指定键 + """ + if not isinstance(d, dict): + return d + keys = list(d.keys()) + for key in keys: + if key in keys_to_delete: + del d[key] + else: + delete_keys(d[key], keys_to_delete) + return d + d = delete_keys(d, ['secret', 'ansible_password']) + with open(path, 'w') as f: + json.dump(d, f) + def run(self, *args, **kwargs): runners = self.get_runners() if len(runners) > 1: @@ -213,6 +238,7 @@ class BasePlaybookManager: self.before_runner_start(runner) try: cb = runner.run(**kwargs) + self.delete_sensitive_data(runner.inventory) self.on_runner_success(runner, cb) except Exception as e: self.on_runner_failed(runner, e) diff --git a/apps/assets/const/host.py b/apps/assets/const/host.py index 11d9e3407..a2e99865e 100644 --- a/apps/assets/const/host.py +++ b/apps/assets/const/host.py @@ -81,7 +81,13 @@ class HostTypes(BaseType): {'name': 'Unix'}, {'name': 'macOS'}, {'name': 'BSD'}, - {'name': 'AIX'}, + { + 'name': 'AIX', + 'automation': { + 'push_account_method': 'push_account_aix', + 'change_secret_method': 'change_secret_aix', + } + }, ], cls.WINDOWS: [ {'name': 'Windows'}, diff --git a/apps/ops/signal_handlers.py b/apps/ops/signal_handlers.py index 7d4e15789..b27a741ae 100644 --- a/apps/ops/signal_handlers.py +++ b/apps/ops/signal_handlers.py @@ -51,7 +51,8 @@ def check_registered_tasks(*args, **kwargs): continue for attr in attrs: if not hasattr(task, attr): - print('>>> Task {} has no attribute {}'.format(name, attr)) + # print('>>> Task {} has no attribute {}'.format(name, attr)) + pass @signals.before_task_publish.connect From b76ed67c9c29de9fe58997a33817a3fe994a3a46 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 19:21:32 +0800 Subject: [PATCH 09/17] =?UTF-8?q?perf:=20=E8=B6=85=E6=97=B6=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4=20=E8=A7=A3=E9=87=8A=20(#9653)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/locale/ja/LC_MESSAGES/django.po | 180 +++++++++++++------------- apps/locale/zh/LC_MESSAGES/django.mo | 4 +- apps/locale/zh/LC_MESSAGES/django.po | 182 +++++++++++++-------------- 3 files changed, 181 insertions(+), 185 deletions(-) diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 73b8168db..a2156418c 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-02-20 15:19+0800\n" +"POT-Creation-Date: 2023-02-20 19:19+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -159,7 +159,7 @@ msgid "Only create" msgstr "作成のみ" #: accounts/models/account.py:47 accounts/models/gathered_account.py:14 -#: accounts/serializers/account/account.py:97 +#: accounts/serializers/account/account.py:95 #: accounts/serializers/account/gathered_account.py:10 #: accounts/serializers/automations/change_secret.py:107 #: accounts/serializers/automations/change_secret.py:127 @@ -175,7 +175,7 @@ msgstr "作成のみ" msgid "Asset" msgstr "資産" -#: accounts/models/account.py:51 accounts/serializers/account/account.py:101 +#: accounts/models/account.py:51 accounts/serializers/account/account.py:99 #: authentication/serializers/connect_token_secret.py:50 msgid "Su from" msgstr "から切り替え" @@ -185,7 +185,7 @@ msgstr "から切り替え" msgid "Version" msgstr "バージョン" -#: accounts/models/account.py:55 accounts/serializers/account/account.py:98 +#: accounts/models/account.py:55 accounts/serializers/account/account.py:96 #: users/models/user.py:768 msgid "Source" msgstr "ソース" @@ -228,7 +228,7 @@ msgstr "アセット アカウント テンプレートのパスワードを変 #: accounts/models/automations/backup_account.py:27 #: accounts/models/automations/change_secret.py:47 -#: accounts/serializers/account/backup.py:32 +#: accounts/serializers/account/backup.py:34 #: accounts/serializers/automations/change_secret.py:56 msgid "Recipient" msgstr "受信者" @@ -240,7 +240,7 @@ 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:119 +#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:122 #: perms/models/asset_permission.py:72 terminal/models/applet/host.py:108 #: terminal/models/session/session.py:45 #: tickets/models/ticket/apply_application.py:30 @@ -259,7 +259,7 @@ msgid "Account backup snapshot" msgstr "アカウントのバックアップスナップショット" #: accounts/models/automations/backup_account.py:94 -#: accounts/serializers/account/backup.py:40 +#: accounts/serializers/account/backup.py:42 #: accounts/serializers/automations/base.py:44 #: assets/models/automations/base.py:121 #: assets/serializers/automations/base.py:40 @@ -319,7 +319,7 @@ msgid "Can add push account execution" msgstr "プッシュ アカウントの作成の実行" #: accounts/models/automations/change_secret.py:17 accounts/models/base.py:36 -#: accounts/serializers/account/account.py:134 +#: accounts/serializers/account/account.py:132 #: accounts/serializers/account/base.py:16 #: accounts/serializers/automations/change_secret.py:46 #: authentication/serializers/connect_token_secret.py:41 @@ -362,7 +362,7 @@ msgstr "開始日" #: accounts/models/automations/change_secret.py:74 #: assets/models/automations/base.py:115 ops/models/base.py:56 -#: ops/models/celery.py:64 ops/models/job.py:120 +#: ops/models/celery.py:64 ops/models/job.py:123 #: terminal/models/applet/host.py:109 msgid "Date finished" msgstr "終了日" @@ -420,14 +420,13 @@ msgstr "アカウントの確認" #: assets/models/asset/common.py:90 assets/models/asset/common.py:102 #: 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:20 assets/models/platform.py:74 +#: assets/models/platform.py:21 assets/models/platform.py:76 #: assets/serializers/asset/common.py:68 assets/serializers/asset/common.py:142 -#: assets/serializers/platform.py:131 +#: assets/serializers/platform.py:132 #: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21 #: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57 #: ops/models/job.py:26 ops/models/playbook.py:23 ops/serializers/job.py:19 -#: ops/serializers/playbook.py:19 orgs/models.py:69 -#: perms/models/asset_permission.py:56 rbac/models/role.py:29 +#: 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/component/endpoint.py:90 @@ -507,35 +506,35 @@ msgstr "" "{} -暗号化変更タスクが完了しました: 暗号化パスワードが設定されていません-個人" "情報にアクセスしてください-> ファイル暗号化パスワードを設定してください" -#: accounts/serializers/account/account.py:67 +#: accounts/serializers/account/account.py:65 #: assets/serializers/asset/common.py:66 settings/serializers/auth/sms.py:75 msgid "Template" msgstr "テンプレート" -#: accounts/serializers/account/account.py:70 +#: accounts/serializers/account/account.py:68 #: assets/serializers/asset/common.py:63 msgid "Push now" msgstr "今すぐプッシュ" -#: accounts/serializers/account/account.py:72 +#: accounts/serializers/account/account.py:70 #: accounts/serializers/account/base.py:62 msgid "Has secret" msgstr "エスクローされたパスワード" -#: accounts/serializers/account/account.py:77 applications/models.py:11 -#: assets/models/label.py:21 assets/models/platform.py:75 +#: accounts/serializers/account/account.py:75 applications/models.py:11 +#: assets/models/label.py:21 assets/models/platform.py:77 #: assets/serializers/asset/common.py:121 assets/serializers/cagegory.py:8 -#: assets/serializers/platform.py:93 assets/serializers/platform.py:132 +#: assets/serializers/platform.py:93 assets/serializers/platform.py:133 #: perms/serializers/user_permission.py:25 settings/models.py:35 #: tickets/models/ticket/apply_application.py:13 msgid "Category" msgstr "カテゴリ" -#: accounts/serializers/account/account.py:78 +#: accounts/serializers/account/account.py:76 #: accounts/serializers/automations/base.py:43 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:76 +#: assets/models/cmd_filter.py:74 assets/models/platform.py:78 #: assets/serializers/asset/common.py:122 assets/serializers/platform.py:92 #: audits/serializers.py:48 #: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:37 @@ -550,28 +549,28 @@ msgstr "カテゴリ" msgid "Type" msgstr "タイプ" -#: accounts/serializers/account/account.py:93 +#: accounts/serializers/account/account.py:91 msgid "Asset not found" msgstr "資産が存在しません" -#: accounts/serializers/account/backup.py:30 +#: accounts/serializers/account/backup.py:31 #: accounts/serializers/automations/base.py:36 #: assets/serializers/automations/base.py:34 ops/mixin.py:23 ops/mixin.py:103 #: settings/serializers/auth/ldap.py:66 msgid "Periodic perform" msgstr "定期的なパフォーマンス" -#: accounts/serializers/account/backup.py:31 +#: accounts/serializers/account/backup.py:32 #: accounts/serializers/automations/base.py:37 msgid "Executed amount" msgstr "実行回数" -#: accounts/serializers/account/backup.py:33 +#: accounts/serializers/account/backup.py:35 #: accounts/serializers/automations/change_secret.py:57 msgid "Currently only mail sending is supported" msgstr "現在、メール送信のみがサポートされています" -#: accounts/serializers/account/backup.py:35 +#: accounts/serializers/account/backup.py:37 msgid "Asset type" msgstr "資産タイプ" @@ -816,7 +815,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:37 +#: acls/serializers/base.py:40 assets/serializers/asset/host.py:36 msgid "IP/Host" msgstr "IP/ホスト" @@ -896,13 +895,13 @@ msgstr "アプリケーション" msgid "Can match application" msgstr "アプリケーションを一致させることができます" -#: assets/api/asset/asset.py:145 +#: assets/api/asset/asset.py:144 msgid "Cannot create asset directly, you should create a host or other" msgstr "" "資産を直接作成することはできません。ホストまたはその他を作成する必要がありま" "す" -#: assets/api/domain.py:61 +#: assets/api/domain.py:60 msgid "Number required" msgstr "必要な数" @@ -922,7 +921,7 @@ msgstr "削除に失敗し、ノードにアセットが含まれています。 msgid "App assets" msgstr "アプリ資産" -#: assets/automations/base/manager.py:104 +#: assets/automations/base/manager.py:105 msgid "{} disabled" msgstr "{} 無効" @@ -1043,11 +1042,10 @@ msgstr "SSHパブリックキー" #: assets/models/_user.py:27 assets/models/cmd_filter.py:40 #: assets/models/cmd_filter.py:88 assets/models/group.py:23 -#: assets/models/platform.py:79 common/db/models.py:37 ops/models/adhoc.py:27 -#: ops/models/job.py:45 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:151 terminal/models/applet/host.py:110 -#: terminal/models/component/endpoint.py:24 +#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:45 +#: 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:151 +#: terminal/models/applet/host.py:110 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 #: tickets/models/ticket/general.py:297 users/models/user.py:756 @@ -1057,7 +1055,7 @@ msgstr "コメント" #: assets/models/_user.py:28 assets/models/automations/base.py:113 #: 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:118 +#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:121 #: users/models/user.py:943 msgid "Date created" msgstr "作成された日付" @@ -1149,7 +1147,7 @@ msgstr "システムユーザーに一致できます" msgid "Cloud" msgstr "クラウド サービス" -#: assets/models/asset/common.py:91 assets/models/platform.py:21 +#: assets/models/asset/common.py:91 assets/models/platform.py:22 #: settings/serializers/auth/radius.py:17 settings/serializers/auth/sms.py:68 #: xpack/plugins/cloud/serializers/account_attrs.py:73 msgid "Port" @@ -1159,7 +1157,7 @@ msgstr "ポート" msgid "Address" msgstr "アドレス" -#: assets/models/asset/common.py:104 assets/models/platform.py:111 +#: assets/models/asset/common.py:104 assets/models/platform.py:112 #: authentication/serializers/connect_token_secret.py:108 #: perms/serializers/user_permission.py:23 #: xpack/plugins/cloud/serializers/account_attrs.py:187 @@ -1262,7 +1260,7 @@ 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:111 +#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:114 #: terminal/models/applet/applet.py:150 terminal/models/applet/host.py:107 #: terminal/models/component/status.py:27 terminal/serializers/applet.py:17 #: terminal/serializers/applet_host.py:93 tickets/models/ticket/general.py:283 @@ -1330,7 +1328,7 @@ msgstr "ゲートウェイ" msgid "Asset group" msgstr "資産グループ" -#: assets/models/group.py:34 assets/models/platform.py:18 +#: assets/models/group.py:34 assets/models/platform.py:19 #: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "デフォルト" @@ -1387,91 +1385,91 @@ msgstr "ノード" msgid "Can match node" msgstr "ノードを一致させることができます" -#: assets/models/platform.py:19 +#: assets/models/platform.py:20 msgid "Required" msgstr "必要" -#: assets/models/platform.py:22 settings/serializers/settings.py:61 +#: assets/models/platform.py:23 settings/serializers/settings.py:61 #: users/templates/users/reset_password.html:29 msgid "Setting" msgstr "設定" -#: assets/models/platform.py:41 audits/const.py:47 settings/models.py:37 +#: assets/models/platform.py:42 audits/const.py:47 settings/models.py:37 #: terminal/serializers/applet_host.py:29 msgid "Enabled" msgstr "有効化" -#: assets/models/platform.py:42 +#: assets/models/platform.py:43 msgid "Ansible config" msgstr "Ansible 構成" -#: assets/models/platform.py:43 assets/serializers/platform.py:60 +#: assets/models/platform.py:44 assets/serializers/platform.py:60 msgid "Ping enabled" msgstr "アセット ディスカバリを有効にする" -#: assets/models/platform.py:44 assets/serializers/platform.py:61 +#: assets/models/platform.py:45 assets/serializers/platform.py:61 msgid "Ping method" msgstr "資産検出方法" -#: assets/models/platform.py:45 assets/models/platform.py:58 +#: assets/models/platform.py:46 assets/models/platform.py:59 #: assets/serializers/platform.py:62 msgid "Gather facts enabled" msgstr "資産情報の収集を有効にする" -#: assets/models/platform.py:46 assets/models/platform.py:60 +#: assets/models/platform.py:47 assets/models/platform.py:61 #: assets/serializers/platform.py:63 msgid "Gather facts method" msgstr "情報収集の方法" -#: assets/models/platform.py:47 assets/serializers/platform.py:66 +#: assets/models/platform.py:48 assets/serializers/platform.py:66 msgid "Change secret enabled" msgstr "パスワードの変更が有効" -#: assets/models/platform.py:49 assets/serializers/platform.py:67 +#: assets/models/platform.py:50 assets/serializers/platform.py:67 msgid "Change secret method" msgstr "パスワード変更モード" -#: assets/models/platform.py:51 assets/serializers/platform.py:68 +#: assets/models/platform.py:52 assets/serializers/platform.py:68 msgid "Push account enabled" msgstr "アカウントのプッシュを有効にする" -#: assets/models/platform.py:53 assets/serializers/platform.py:69 +#: assets/models/platform.py:54 assets/serializers/platform.py:69 msgid "Push account method" msgstr "アカウントプッシュ方式" -#: assets/models/platform.py:55 assets/serializers/platform.py:64 +#: assets/models/platform.py:56 assets/serializers/platform.py:64 msgid "Verify account enabled" msgstr "アカウントの確認をオンにする" -#: assets/models/platform.py:57 assets/serializers/platform.py:65 +#: assets/models/platform.py:58 assets/serializers/platform.py:65 msgid "Verify account method" msgstr "アカウント認証方法" -#: assets/models/platform.py:77 tickets/models/ticket/general.py:300 +#: assets/models/platform.py:79 tickets/models/ticket/general.py:300 msgid "Meta" msgstr "メタ" -#: assets/models/platform.py:78 +#: assets/models/platform.py:80 msgid "Internal" msgstr "ビルトイン" -#: assets/models/platform.py:82 assets/serializers/platform.py:90 +#: assets/models/platform.py:83 assets/serializers/platform.py:90 msgid "Charset" msgstr "シャーセット" -#: assets/models/platform.py:84 assets/serializers/platform.py:117 +#: assets/models/platform.py:85 assets/serializers/platform.py:118 msgid "Domain enabled" msgstr "ドメインを有効にする" -#: assets/models/platform.py:86 assets/serializers/platform.py:116 +#: assets/models/platform.py:87 assets/serializers/platform.py:117 msgid "Su enabled" msgstr "アカウントの切り替えを有効にする" -#: assets/models/platform.py:87 assets/serializers/platform.py:100 +#: assets/models/platform.py:88 assets/serializers/platform.py:100 msgid "Su method" msgstr "アカウントの切り替え方法" -#: assets/models/platform.py:89 assets/serializers/platform.py:97 +#: assets/models/platform.py:90 assets/serializers/platform.py:97 msgid "Automation" msgstr "オートメーション" @@ -1531,40 +1529,40 @@ msgstr "モデル" msgid "Serial number" msgstr "シリアル番号" -#: assets/serializers/asset/host.py:16 +#: assets/serializers/asset/host.py:15 msgid "CPU model" msgstr "CPU モデル" -#: assets/serializers/asset/host.py:17 +#: assets/serializers/asset/host.py:16 msgid "CPU count" msgstr "CPU カウント" -#: assets/serializers/asset/host.py:18 +#: assets/serializers/asset/host.py:17 msgid "CPU cores" msgstr "CPU カラー" -#: assets/serializers/asset/host.py:19 +#: assets/serializers/asset/host.py:18 msgid "CPU vcpus" msgstr "CPU 合計" -#: assets/serializers/asset/host.py:20 +#: assets/serializers/asset/host.py:19 msgid "Memory" msgstr "メモリ" -#: assets/serializers/asset/host.py:21 +#: assets/serializers/asset/host.py:20 msgid "Disk total" msgstr "ディスクの合計" -#: assets/serializers/asset/host.py:23 +#: assets/serializers/asset/host.py:22 #: authentication/serializers/connect_token_secret.py:105 msgid "OS" msgstr "OS" -#: assets/serializers/asset/host.py:24 +#: assets/serializers/asset/host.py:23 msgid "OS version" msgstr "システムバージョン" -#: assets/serializers/asset/host.py:25 +#: assets/serializers/asset/host.py:24 msgid "OS arch" msgstr "システムアーキテクチャ" @@ -1620,7 +1618,7 @@ msgstr "アカウントの収集方法" msgid "Primary" msgstr "主要" -#: assets/serializers/platform.py:118 +#: assets/serializers/platform.py:119 msgid "Default Domain" msgstr "デフォルト ドメイン" @@ -1628,7 +1626,7 @@ msgstr "デフォルト ドメイン" msgid "Test assets connectivity " msgstr "アセット接続のテスト。" -#: assets/signal_handlers/asset.py:35 +#: assets/signal_handlers/asset.py:36 msgid "Gather asset hardware info" msgstr "資産ハードウェア情報の収集" @@ -1781,8 +1779,8 @@ msgstr "セッションログ" msgid "Login log" msgstr "ログインログ" -#: audits/const.py:42 ops/signal_handlers.py:86 -#: terminal/models/applet/host.py:111 terminal/models/component/task.py:24 +#: audits/const.py:42 terminal/models/applet/host.py:111 +#: terminal/models/component/task.py:24 msgid "Task" msgstr "タスク" @@ -1981,7 +1979,7 @@ msgstr "ACL アクションはレビューです" msgid "Current user not support mfa type: {}" msgstr "現在のユーザーはmfaタイプをサポートしていません: {}" -#: authentication/api/password.py:31 terminal/api/session/session.py:244 +#: authentication/api/password.py:31 terminal/api/session/session.py:247 #: users/views/profile/reset.py:44 msgid "User does not exist: {}" msgstr "ユーザーが存在しない: {}" @@ -3341,7 +3339,7 @@ msgid "Args" msgstr "アルグ" #: ops/models/adhoc.py:26 ops/models/base.py:16 ops/models/base.py:53 -#: ops/models/job.py:38 ops/models/job.py:117 ops/models/playbook.py:25 +#: ops/models/job.py:38 ops/models/job.py:120 ops/models/playbook.py:25 #: terminal/models/session/sharing.py:23 msgid "Creator" msgstr "作成者" @@ -3358,12 +3356,12 @@ msgstr "最後の実行" msgid "Date last run" msgstr "最終実行日" -#: ops/models/base.py:51 ops/models/job.py:115 +#: ops/models/base.py:51 ops/models/job.py:118 #: xpack/plugins/cloud/models.py:162 msgid "Result" msgstr "結果" -#: ops/models/base.py:52 ops/models/job.py:116 +#: ops/models/base.py:52 ops/models/job.py:119 msgid "Summary" msgstr "概要" @@ -3427,23 +3425,23 @@ msgstr "ユーザーとして実行" msgid "Runas policy" msgstr "ユーザー ポリシー" -#: ops/models/job.py:103 +#: ops/models/job.py:106 msgid "Job" msgstr "ジョブ#ジョブ#" -#: ops/models/job.py:114 +#: ops/models/job.py:117 msgid "Parameters" msgstr "パラメータ" -#: ops/models/job.py:122 +#: ops/models/job.py:125 msgid "Material" msgstr "" -#: ops/models/job.py:124 +#: ops/models/job.py:127 msgid "Material Type" msgstr "" -#: ops/models/job.py:361 +#: ops/models/job.py:364 msgid "Job Execution" msgstr "ジョブ実行" @@ -3559,18 +3557,18 @@ msgstr "ジョブのID" msgid "Name of the job" msgstr "ジョブの名前" -#: orgs/api.py:63 +#: orgs/api.py:62 msgid "The current organization ({}) cannot be deleted" msgstr "現在の組織 ({}) は削除できません" -#: orgs/api.py:68 +#: orgs/api.py:67 msgid "" "LDAP synchronization is set to the current organization. Please switch to " "another organization before deleting" msgstr "" "LDAP 同期は現在の組織に設定されます。削除する前に別の組織に切り替えてください" -#: orgs/api.py:78 +#: orgs/api.py:77 msgid "The organization have resource ({}) cannot be deleted" msgstr "組織のリソース ({}) は削除できません" @@ -5333,19 +5331,19 @@ msgstr "テスト成功" msgid "Test failure: Account invalid" msgstr "テスト失敗: アカウントが無効" -#: terminal/api/component/terminal.py:35 +#: terminal/api/component/terminal.py:55 msgid "Have online sessions" msgstr "オンラインセッションを持つ" -#: terminal/api/session/session.py:236 +#: terminal/api/session/session.py:239 msgid "Session does not exist: {}" msgstr "セッションが存在しません: {}" -#: terminal/api/session/session.py:239 +#: terminal/api/session/session.py:242 msgid "Session is finished or the protocol not supported" msgstr "セッションが終了したか、プロトコルがサポートされていません" -#: terminal/api/session/session.py:252 +#: terminal/api/session/session.py:255 msgid "User does not have permission" msgstr "ユーザーに権限がありません" @@ -6245,7 +6243,7 @@ msgstr "無効な承認アクション" msgid "This user is not authorized to approve this ticket" msgstr "このユーザーはこの作業指示を承認する権限がありません" -#: users/api/user.py:179 +#: users/api/user.py:178 msgid "Could not reset self otp, use profile reset instead" msgstr "自己otpをリセットできませんでした、代わりにプロファイルリセットを使用" diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 20a3f93dd..e462b3e98 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:e078689bb42c8b769f77944c3498f367562da35346fcd0c6c2766c85e5107d1b -size 111727 +oid sha256:3a10e56f57d89f413c4aac8026e4339f630f70f6a66df8b9edee5b39bed88a75 +size 111742 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 88c19aeae..6c9b0c6c7 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-02-20 15:19+0800\n" +"POT-Creation-Date: 2023-02-20 19:19+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -158,7 +158,7 @@ msgid "Only create" msgstr "仅创建" #: accounts/models/account.py:47 accounts/models/gathered_account.py:14 -#: accounts/serializers/account/account.py:97 +#: accounts/serializers/account/account.py:95 #: accounts/serializers/account/gathered_account.py:10 #: accounts/serializers/automations/change_secret.py:107 #: accounts/serializers/automations/change_secret.py:127 @@ -174,7 +174,7 @@ msgstr "仅创建" msgid "Asset" msgstr "资产" -#: accounts/models/account.py:51 accounts/serializers/account/account.py:101 +#: accounts/models/account.py:51 accounts/serializers/account/account.py:99 #: authentication/serializers/connect_token_secret.py:50 msgid "Su from" msgstr "切换自" @@ -184,7 +184,7 @@ msgstr "切换自" msgid "Version" msgstr "版本" -#: accounts/models/account.py:55 accounts/serializers/account/account.py:98 +#: accounts/models/account.py:55 accounts/serializers/account/account.py:96 #: users/models/user.py:768 msgid "Source" msgstr "来源" @@ -227,7 +227,7 @@ msgstr "可以更改资产账号模版密码" #: accounts/models/automations/backup_account.py:27 #: accounts/models/automations/change_secret.py:47 -#: accounts/serializers/account/backup.py:32 +#: accounts/serializers/account/backup.py:34 #: accounts/serializers/automations/change_secret.py:56 msgid "Recipient" msgstr "收件人" @@ -239,7 +239,7 @@ 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:119 +#: ops/models/base.py:55 ops/models/celery.py:63 ops/models/job.py:122 #: perms/models/asset_permission.py:72 terminal/models/applet/host.py:108 #: terminal/models/session/session.py:45 #: tickets/models/ticket/apply_application.py:30 @@ -258,7 +258,7 @@ msgid "Account backup snapshot" msgstr "账号备份快照" #: accounts/models/automations/backup_account.py:94 -#: accounts/serializers/account/backup.py:40 +#: accounts/serializers/account/backup.py:42 #: accounts/serializers/automations/base.py:44 #: assets/models/automations/base.py:121 #: assets/serializers/automations/base.py:40 @@ -318,7 +318,7 @@ msgid "Can add push account execution" msgstr "创建推送账号执行" #: accounts/models/automations/change_secret.py:17 accounts/models/base.py:36 -#: accounts/serializers/account/account.py:134 +#: accounts/serializers/account/account.py:132 #: accounts/serializers/account/base.py:16 #: accounts/serializers/automations/change_secret.py:46 #: authentication/serializers/connect_token_secret.py:41 @@ -361,7 +361,7 @@ msgstr "开始日期" #: accounts/models/automations/change_secret.py:74 #: assets/models/automations/base.py:115 ops/models/base.py:56 -#: ops/models/celery.py:64 ops/models/job.py:120 +#: ops/models/celery.py:64 ops/models/job.py:123 #: terminal/models/applet/host.py:109 msgid "Date finished" msgstr "结束日期" @@ -419,14 +419,13 @@ msgstr "账号验证" #: assets/models/asset/common.py:90 assets/models/asset/common.py:102 #: 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:20 assets/models/platform.py:74 +#: assets/models/platform.py:21 assets/models/platform.py:76 #: assets/serializers/asset/common.py:68 assets/serializers/asset/common.py:142 -#: assets/serializers/platform.py:131 +#: assets/serializers/platform.py:132 #: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21 #: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57 #: ops/models/job.py:26 ops/models/playbook.py:23 ops/serializers/job.py:19 -#: ops/serializers/playbook.py:19 orgs/models.py:69 -#: perms/models/asset_permission.py:56 rbac/models/role.py:29 +#: 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/component/endpoint.py:90 @@ -503,35 +502,35 @@ msgstr "" "{} - 改密任务已完成: 未设置加密密码 - 请前往个人信息 -> 文件加密密码中设置加" "密密码" -#: accounts/serializers/account/account.py:67 +#: accounts/serializers/account/account.py:65 #: assets/serializers/asset/common.py:66 settings/serializers/auth/sms.py:75 msgid "Template" msgstr "模板" -#: accounts/serializers/account/account.py:70 +#: accounts/serializers/account/account.py:68 #: assets/serializers/asset/common.py:63 msgid "Push now" msgstr "立即推送" -#: accounts/serializers/account/account.py:72 +#: accounts/serializers/account/account.py:70 #: accounts/serializers/account/base.py:62 msgid "Has secret" msgstr "已托管密码" -#: accounts/serializers/account/account.py:77 applications/models.py:11 -#: assets/models/label.py:21 assets/models/platform.py:75 +#: accounts/serializers/account/account.py:75 applications/models.py:11 +#: assets/models/label.py:21 assets/models/platform.py:77 #: assets/serializers/asset/common.py:121 assets/serializers/cagegory.py:8 -#: assets/serializers/platform.py:93 assets/serializers/platform.py:132 +#: assets/serializers/platform.py:93 assets/serializers/platform.py:133 #: perms/serializers/user_permission.py:25 settings/models.py:35 #: tickets/models/ticket/apply_application.py:13 msgid "Category" msgstr "类别" -#: accounts/serializers/account/account.py:78 +#: accounts/serializers/account/account.py:76 #: accounts/serializers/automations/base.py:43 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:76 +#: assets/models/cmd_filter.py:74 assets/models/platform.py:78 #: assets/serializers/asset/common.py:122 assets/serializers/platform.py:92 #: audits/serializers.py:48 #: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:37 @@ -546,28 +545,28 @@ msgstr "类别" msgid "Type" msgstr "类型" -#: accounts/serializers/account/account.py:93 +#: accounts/serializers/account/account.py:91 msgid "Asset not found" msgstr "资产不存在" -#: accounts/serializers/account/backup.py:30 +#: accounts/serializers/account/backup.py:31 #: accounts/serializers/automations/base.py:36 #: assets/serializers/automations/base.py:34 ops/mixin.py:23 ops/mixin.py:103 #: settings/serializers/auth/ldap.py:66 msgid "Periodic perform" msgstr "定时执行" -#: accounts/serializers/account/backup.py:31 +#: accounts/serializers/account/backup.py:32 #: accounts/serializers/automations/base.py:37 msgid "Executed amount" msgstr "执行次数" -#: accounts/serializers/account/backup.py:33 +#: accounts/serializers/account/backup.py:35 #: accounts/serializers/automations/change_secret.py:57 msgid "Currently only mail sending is supported" msgstr "当前只支持邮件发送" -#: accounts/serializers/account/backup.py:35 +#: accounts/serializers/account/backup.py:37 msgid "Asset type" msgstr "资产类型" @@ -811,7 +810,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:37 +#: acls/serializers/base.py:40 assets/serializers/asset/host.py:36 msgid "IP/Host" msgstr "IP/主机" @@ -890,11 +889,11 @@ msgstr "应用程序" msgid "Can match application" msgstr "匹配应用" -#: assets/api/asset/asset.py:145 +#: assets/api/asset/asset.py:144 msgid "Cannot create asset directly, you should create a host or other" msgstr "不能直接创建资产, 你应该创建主机或其他资产" -#: assets/api/domain.py:61 +#: assets/api/domain.py:60 msgid "Number required" msgstr "需要为数字" @@ -914,7 +913,7 @@ msgstr "删除失败,节点包含资产" msgid "App assets" msgstr "资产管理" -#: assets/automations/base/manager.py:104 +#: assets/automations/base/manager.py:105 msgid "{} disabled" msgstr "{} 已禁用" @@ -1035,11 +1034,10 @@ msgstr "SSH公钥" #: assets/models/_user.py:27 assets/models/cmd_filter.py:40 #: assets/models/cmd_filter.py:88 assets/models/group.py:23 -#: assets/models/platform.py:79 common/db/models.py:37 ops/models/adhoc.py:27 -#: ops/models/job.py:45 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:151 terminal/models/applet/host.py:110 -#: terminal/models/component/endpoint.py:24 +#: common/db/models.py:37 ops/models/adhoc.py:27 ops/models/job.py:45 +#: 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:151 +#: terminal/models/applet/host.py:110 terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:100 #: terminal/models/session/session.py:47 tickets/models/comment.py:32 #: tickets/models/ticket/general.py:297 users/models/user.py:756 @@ -1049,7 +1047,7 @@ msgstr "备注" #: assets/models/_user.py:28 assets/models/automations/base.py:113 #: 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:118 +#: common/db/models.py:35 ops/models/base.py:54 ops/models/job.py:121 #: users/models/user.py:943 msgid "Date created" msgstr "创建日期" @@ -1141,7 +1139,7 @@ msgstr "可以匹配系统用户" msgid "Cloud" msgstr "云服务" -#: assets/models/asset/common.py:91 assets/models/platform.py:21 +#: assets/models/asset/common.py:91 assets/models/platform.py:22 #: settings/serializers/auth/radius.py:17 settings/serializers/auth/sms.py:68 #: xpack/plugins/cloud/serializers/account_attrs.py:73 msgid "Port" @@ -1151,7 +1149,7 @@ msgstr "端口" msgid "Address" msgstr "地址" -#: assets/models/asset/common.py:104 assets/models/platform.py:111 +#: assets/models/asset/common.py:104 assets/models/platform.py:112 #: authentication/serializers/connect_token_secret.py:108 #: perms/serializers/user_permission.py:23 #: xpack/plugins/cloud/serializers/account_attrs.py:187 @@ -1254,7 +1252,7 @@ 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:111 +#: audits/serializers.py:49 ops/models/base.py:49 ops/models/job.py:114 #: terminal/models/applet/applet.py:150 terminal/models/applet/host.py:107 #: terminal/models/component/status.py:27 terminal/serializers/applet.py:17 #: terminal/serializers/applet_host.py:93 tickets/models/ticket/general.py:283 @@ -1322,7 +1320,7 @@ msgstr "网关" msgid "Asset group" msgstr "资产组" -#: assets/models/group.py:34 assets/models/platform.py:18 +#: assets/models/group.py:34 assets/models/platform.py:19 #: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "默认" @@ -1379,91 +1377,91 @@ msgstr "节点" msgid "Can match node" msgstr "可以匹配节点" -#: assets/models/platform.py:19 +#: assets/models/platform.py:20 msgid "Required" msgstr "必须的" -#: assets/models/platform.py:22 settings/serializers/settings.py:61 +#: assets/models/platform.py:23 settings/serializers/settings.py:61 #: users/templates/users/reset_password.html:29 msgid "Setting" msgstr "设置" -#: assets/models/platform.py:41 audits/const.py:47 settings/models.py:37 +#: assets/models/platform.py:42 audits/const.py:47 settings/models.py:37 #: terminal/serializers/applet_host.py:29 msgid "Enabled" msgstr "启用" -#: assets/models/platform.py:42 +#: assets/models/platform.py:43 msgid "Ansible config" msgstr "Ansible 配置" -#: assets/models/platform.py:43 assets/serializers/platform.py:60 +#: assets/models/platform.py:44 assets/serializers/platform.py:60 msgid "Ping enabled" msgstr "启用资产探活" -#: assets/models/platform.py:44 assets/serializers/platform.py:61 +#: assets/models/platform.py:45 assets/serializers/platform.py:61 msgid "Ping method" msgstr "资产探活方式" -#: assets/models/platform.py:45 assets/models/platform.py:58 +#: assets/models/platform.py:46 assets/models/platform.py:59 #: assets/serializers/platform.py:62 msgid "Gather facts enabled" msgstr "启用收集资产信息" -#: assets/models/platform.py:46 assets/models/platform.py:60 +#: assets/models/platform.py:47 assets/models/platform.py:61 #: assets/serializers/platform.py:63 msgid "Gather facts method" msgstr "收集信息方式" -#: assets/models/platform.py:47 assets/serializers/platform.py:66 +#: assets/models/platform.py:48 assets/serializers/platform.py:66 msgid "Change secret enabled" msgstr "启用改密" -#: assets/models/platform.py:49 assets/serializers/platform.py:67 +#: assets/models/platform.py:50 assets/serializers/platform.py:67 msgid "Change secret method" msgstr "改密方式" -#: assets/models/platform.py:51 assets/serializers/platform.py:68 +#: assets/models/platform.py:52 assets/serializers/platform.py:68 msgid "Push account enabled" msgstr "启用账号推送" -#: assets/models/platform.py:53 assets/serializers/platform.py:69 +#: assets/models/platform.py:54 assets/serializers/platform.py:69 msgid "Push account method" msgstr "账号推送方式" -#: assets/models/platform.py:55 assets/serializers/platform.py:64 +#: assets/models/platform.py:56 assets/serializers/platform.py:64 msgid "Verify account enabled" msgstr "开启账号验证" -#: assets/models/platform.py:57 assets/serializers/platform.py:65 +#: assets/models/platform.py:58 assets/serializers/platform.py:65 msgid "Verify account method" msgstr "账号验证方式" -#: assets/models/platform.py:77 tickets/models/ticket/general.py:300 +#: assets/models/platform.py:79 tickets/models/ticket/general.py:300 msgid "Meta" msgstr "元数据" -#: assets/models/platform.py:78 +#: assets/models/platform.py:80 msgid "Internal" msgstr "内置" -#: assets/models/platform.py:82 assets/serializers/platform.py:90 +#: assets/models/platform.py:83 assets/serializers/platform.py:90 msgid "Charset" msgstr "编码" -#: assets/models/platform.py:84 assets/serializers/platform.py:117 +#: assets/models/platform.py:85 assets/serializers/platform.py:118 msgid "Domain enabled" msgstr "启用网域" -#: assets/models/platform.py:86 assets/serializers/platform.py:116 +#: assets/models/platform.py:87 assets/serializers/platform.py:117 msgid "Su enabled" msgstr "启用账号切换" -#: assets/models/platform.py:87 assets/serializers/platform.py:100 +#: assets/models/platform.py:88 assets/serializers/platform.py:100 msgid "Su method" msgstr "账号切换方式" -#: assets/models/platform.py:89 assets/serializers/platform.py:97 +#: assets/models/platform.py:90 assets/serializers/platform.py:97 msgid "Automation" msgstr "自动化" @@ -1523,40 +1521,40 @@ msgstr "型号" msgid "Serial number" msgstr "序列号" -#: assets/serializers/asset/host.py:16 +#: assets/serializers/asset/host.py:15 msgid "CPU model" msgstr "CPU型号" -#: assets/serializers/asset/host.py:17 +#: assets/serializers/asset/host.py:16 msgid "CPU count" msgstr "CPU数量" -#: assets/serializers/asset/host.py:18 +#: assets/serializers/asset/host.py:17 msgid "CPU cores" msgstr "CPU核数" -#: assets/serializers/asset/host.py:19 +#: assets/serializers/asset/host.py:18 msgid "CPU vcpus" msgstr "CPU总数" -#: assets/serializers/asset/host.py:20 +#: assets/serializers/asset/host.py:19 msgid "Memory" msgstr "内存" -#: assets/serializers/asset/host.py:21 +#: assets/serializers/asset/host.py:20 msgid "Disk total" msgstr "硬盘大小" -#: assets/serializers/asset/host.py:23 +#: assets/serializers/asset/host.py:22 #: authentication/serializers/connect_token_secret.py:105 msgid "OS" msgstr "操作系统" -#: assets/serializers/asset/host.py:24 +#: assets/serializers/asset/host.py:23 msgid "OS version" msgstr "系统版本" -#: assets/serializers/asset/host.py:25 +#: assets/serializers/asset/host.py:24 msgid "OS arch" msgstr "系统架构" @@ -1612,7 +1610,7 @@ msgstr "收集账号方式" msgid "Primary" msgstr "主要的" -#: assets/serializers/platform.py:118 +#: assets/serializers/platform.py:119 msgid "Default Domain" msgstr "默认网域" @@ -1620,7 +1618,7 @@ msgstr "默认网域" msgid "Test assets connectivity " msgstr "测试资产可连接性" -#: assets/signal_handlers/asset.py:35 +#: assets/signal_handlers/asset.py:36 msgid "Gather asset hardware info" msgstr "收集资产硬件信息" @@ -1771,8 +1769,8 @@ msgstr "会话日志" msgid "Login log" msgstr "登录日志" -#: audits/const.py:42 ops/signal_handlers.py:86 -#: terminal/models/applet/host.py:111 terminal/models/component/task.py:24 +#: audits/const.py:42 terminal/models/applet/host.py:111 +#: terminal/models/component/task.py:24 msgid "Task" msgstr "任务" @@ -1971,7 +1969,7 @@ msgstr "ACL 动作是复核" msgid "Current user not support mfa type: {}" msgstr "当前用户不支持 MFA 类型: {}" -#: authentication/api/password.py:31 terminal/api/session/session.py:244 +#: authentication/api/password.py:31 terminal/api/session/session.py:247 #: users/views/profile/reset.py:44 msgid "User does not exist: {}" msgstr "用户不存在: {}" @@ -3306,7 +3304,7 @@ msgid "Args" msgstr "参数" #: ops/models/adhoc.py:26 ops/models/base.py:16 ops/models/base.py:53 -#: ops/models/job.py:38 ops/models/job.py:117 ops/models/playbook.py:25 +#: ops/models/job.py:38 ops/models/job.py:120 ops/models/playbook.py:25 #: terminal/models/session/sharing.py:23 msgid "Creator" msgstr "创建者" @@ -3323,12 +3321,12 @@ msgstr "最后执行" msgid "Date last run" msgstr "最后运行日期" -#: ops/models/base.py:51 ops/models/job.py:115 +#: ops/models/base.py:51 ops/models/job.py:118 #: xpack/plugins/cloud/models.py:162 msgid "Result" msgstr "结果" -#: ops/models/base.py:52 ops/models/job.py:116 +#: ops/models/base.py:52 ops/models/job.py:119 msgid "Summary" msgstr "汇总" @@ -3392,23 +3390,23 @@ msgstr "运行用户" msgid "Runas policy" msgstr "用户策略" -#: ops/models/job.py:103 +#: ops/models/job.py:106 msgid "Job" msgstr "作业" -#: ops/models/job.py:114 +#: ops/models/job.py:117 msgid "Parameters" msgstr "参数" -#: ops/models/job.py:122 +#: ops/models/job.py:125 msgid "Material" msgstr "" -#: ops/models/job.py:124 +#: ops/models/job.py:127 msgid "Material Type" msgstr "" -#: ops/models/job.py:361 +#: ops/models/job.py:364 msgid "Job Execution" msgstr "作业执行" @@ -3524,17 +3522,17 @@ msgstr "Job ID" msgid "Name of the job" msgstr "Job 名称" -#: orgs/api.py:63 +#: orgs/api.py:62 msgid "The current organization ({}) cannot be deleted" msgstr "当前组织 ({}) 不能被删除" -#: orgs/api.py:68 +#: orgs/api.py:67 msgid "" "LDAP synchronization is set to the current organization. Please switch to " "another organization before deleting" msgstr "LDAP 同步设置组织为当前组织,请切换其他组织后再进行删除操作" -#: orgs/api.py:78 +#: orgs/api.py:77 msgid "The organization have resource ({}) cannot be deleted" msgstr "组织存在资源 ({}) 不能被删除" @@ -4752,7 +4750,7 @@ msgstr "验证码有效时间" #: settings/serializers/security.py:117 msgid "Unit: second, reset password and send SMS code expiration time" -msgstr "单位: 秒, 重置密码和发送短信验证码过期时间" +msgstr "单位: 秒, 重置密码的验证码及发送短信的验证码过期时间" #: settings/serializers/security.py:121 msgid "Enable Login dynamic code" @@ -5261,19 +5259,19 @@ msgstr "测试成功" msgid "Test failure: Account invalid" msgstr "测试失败: 账号无效" -#: terminal/api/component/terminal.py:35 +#: terminal/api/component/terminal.py:55 msgid "Have online sessions" msgstr "有在线会话" -#: terminal/api/session/session.py:236 +#: terminal/api/session/session.py:239 msgid "Session does not exist: {}" msgstr "会话不存在: {}" -#: terminal/api/session/session.py:239 +#: terminal/api/session/session.py:242 msgid "Session is finished or the protocol not supported" msgstr "会话已经完成或协议不支持" -#: terminal/api/session/session.py:252 +#: terminal/api/session/session.py:255 msgid "User does not have permission" msgstr "用户没有权限" @@ -6165,7 +6163,7 @@ msgstr "无效的审批动作" msgid "This user is not authorized to approve this ticket" msgstr "此用户无权审批此工单" -#: users/api/user.py:179 +#: users/api/user.py:178 msgid "Could not reset self otp, use profile reset instead" msgstr "不能在该页面重置 MFA 多因子认证, 请去个人信息页面重置" From 137d69a539109542aff4efd5ee992953398aa076 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 20:14:06 +0800 Subject: [PATCH 10/17] perf: ansible runner logs (#9655) Co-authored-by: feng <1304903146@qq.com> --- apps/assets/automations/base/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/assets/automations/base/manager.py b/apps/assets/automations/base/manager.py index be4aa91fe..950b3aebf 100644 --- a/apps/assets/automations/base/manager.py +++ b/apps/assets/automations/base/manager.py @@ -151,8 +151,12 @@ class BasePlaybookManager: return sub_playbook_path def get_runners(self): + # TODO 临时打印一下 找一下打印不出日志的原因 + print('ansible runner: 任务开始执行') + assets_group_by_platform = self.get_assets_group_by_platform() + print('ansible runner: 获取资产分组', assets_group_by_platform) runners = [] - for platform, assets in self.get_assets_group_by_platform().items(): + for platform, assets in assets_group_by_platform.items(): assets_bulked = [assets[i:i + self.bulk_size] for i in range(0, len(assets), self.bulk_size)] for i, _assets in enumerate(assets_bulked, start=1): From 18885974517a893124e7f243ad25492083c63448 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 20 Feb 2023 19:48:44 +0800 Subject: [PATCH 11/17] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9slugfield?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/platform.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/assets/serializers/platform.py b/apps/assets/serializers/platform.py index 893d980a3..277c8388d 100644 --- a/apps/assets/serializers/platform.py +++ b/apps/assets/serializers/platform.py @@ -1,5 +1,6 @@ from django.utils.translation import gettext_lazy as _ from rest_framework import serializers +from django.core import validators from assets.const.web import FillType from common.serializers import WritableNestedModelSerializer @@ -86,6 +87,9 @@ class PlatformProtocolsSerializer(serializers.ModelSerializer): class PlatformSerializer(WritableNestedModelSerializer): + name = serializers.CharField( + label=_("Name"), max_length=50, validators=[validators.validate_unicode_slug] + ) charset = LabeledChoiceField( choices=Platform.CharsetChoices.choices, label=_("Charset") ) From ca22b08cde2a45461345ed7ee30d2362d124db87 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 20 Feb 2023 20:22:26 +0800 Subject: [PATCH 12/17] perf: account update (#9656) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/serializers/account/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/accounts/serializers/account/base.py b/apps/accounts/serializers/account/base.py index 6c1eb95ed..811dc0a71 100644 --- a/apps/accounts/serializers/account/base.py +++ b/apps/accounts/serializers/account/base.py @@ -38,7 +38,7 @@ class AuthValidateMixin(serializers.Serializer): return secret def clean_auth_fields(self, validated_data): - secret_type = validated_data['secret_type'] + secret_type = validated_data.pop('secret_type', None) passphrase = validated_data.get('passphrase') secret = validated_data.pop('secret', None) self.handle_secret(secret, secret_type, passphrase) From 28e28b620b6a174d17651cee1e1d8b0a8521fb95 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Mon, 20 Feb 2023 22:10:59 +0800 Subject: [PATCH 13/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96DBeaver?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BAcli-dos=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/applets/dbeaver/app.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/terminal/applets/dbeaver/app.py b/apps/terminal/applets/dbeaver/app.py index e9a7dff4d..3b058eabd 100644 --- a/apps/terminal/applets/dbeaver/app.py +++ b/apps/terminal/applets/dbeaver/app.py @@ -2,8 +2,7 @@ import os import time import win32api import shutil - -from pywinauto import Application +import subprocess from common import wait_pid, BaseApplication @@ -61,16 +60,18 @@ class AppletApplication(BaseApplication): def run(self): self.launch() - self.app = Application(backend='uia') function = getattr(self, '_get_%s_exec_params' % self.protocol, None) if function is None: params = self._get_exec_params() else: params = function() - exec_string = '%s -con %s' % (self.path, params) - self.app.start(exec_string, wait_for_idle=False) - self.pid = self.app.process + + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = subprocess.SW_HIDE + ret = subprocess.Popen([self.path, '-con', params], startupinfo=startupinfo) + self.pid = ret.pid def wait(self): wait_pid(self.pid) From 296ce7a59f6a2740e5525acb3ab33d7d758deb79 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Mon, 20 Feb 2023 22:21:46 +0800 Subject: [PATCH 14/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/applets/dbeaver/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/terminal/applets/dbeaver/app.py b/apps/terminal/applets/dbeaver/app.py index 3b058eabd..f99fdd54c 100644 --- a/apps/terminal/applets/dbeaver/app.py +++ b/apps/terminal/applets/dbeaver/app.py @@ -70,7 +70,8 @@ class AppletApplication(BaseApplication): startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = subprocess.SW_HIDE - ret = subprocess.Popen([self.path, '-con', params], startupinfo=startupinfo) + exec_string = '%s -con %s' % (self.path, params) + ret = subprocess.Popen(exec_string, startupinfo=startupinfo) self.pid = ret.pid def wait(self): From c8e1660f7ea7ee6e285a2be5b66a5de72ac29c8e Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:36:17 +0800 Subject: [PATCH 15/17] perf: windows not ssh automation (#9658) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/automations/change_secret/manager.py | 6 ++++++ apps/accounts/automations/push_account/manager.py | 5 +++++ apps/accounts/serializers/account/base.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/accounts/automations/change_secret/manager.py b/apps/accounts/automations/change_secret/manager.py index 971877c5f..07e10e83c 100644 --- a/apps/accounts/automations/change_secret/manager.py +++ b/apps/accounts/automations/change_secret/manager.py @@ -11,6 +11,7 @@ from accounts.const import AutomationTypes, SecretType, SSHKeyStrategy, SecretSt from accounts.models import ChangeSecretRecord from accounts.notifications import ChangeSecretExecutionTaskMsg from accounts.serializers import ChangeSecretRecordBackUpSerializer +from assets.const import HostTypes from common.utils import get_logger, lazyproperty from common.utils.file import encrypt_and_compress_zip_file from common.utils.timezone import local_now_display @@ -91,6 +92,11 @@ class ChangeSecretManager(AccountBasePlaybookManager): inventory_hosts = [] records = [] host['secret_type'] = self.secret_type + + if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY: + print(f'Windows {asset} does not support ssh key push \n') + return inventory_hosts + for account in accounts: h = deepcopy(host) h['name'] += '_' + account.username diff --git a/apps/accounts/automations/push_account/manager.py b/apps/accounts/automations/push_account/manager.py index c974106a6..eb8f1d4ac 100644 --- a/apps/accounts/automations/push_account/manager.py +++ b/apps/accounts/automations/push_account/manager.py @@ -4,6 +4,7 @@ from django.db.models import QuerySet from accounts.const import AutomationTypes, SecretType from accounts.models import Account +from assets.const import HostTypes from common.utils import get_logger from ..base.manager import AccountBasePlaybookManager from ..change_secret.manager import ChangeSecretManager @@ -61,6 +62,10 @@ class PushAccountManager(ChangeSecretManager, AccountBasePlaybookManager): inventory_hosts = [] host['secret_type'] = self.secret_type + if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY: + print(f'Windows {asset} does not support ssh key push \n') + return inventory_hosts + for account in accounts: h = deepcopy(host) h['name'] += '_' + account.username diff --git a/apps/accounts/serializers/account/base.py b/apps/accounts/serializers/account/base.py index 811dc0a71..489bd794f 100644 --- a/apps/accounts/serializers/account/base.py +++ b/apps/accounts/serializers/account/base.py @@ -38,7 +38,7 @@ class AuthValidateMixin(serializers.Serializer): return secret def clean_auth_fields(self, validated_data): - secret_type = validated_data.pop('secret_type', None) + secret_type = validated_data.get('secret_type') passphrase = validated_data.get('passphrase') secret = validated_data.pop('secret', None) self.handle_secret(secret, secret_type, passphrase) From b5347be4e3cf4bf54fb466f3cdd1736e107cc763 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Tue, 21 Feb 2023 11:37:30 +0800 Subject: [PATCH 16/17] =?UTF-8?q?perf:=20Navicat=E4=B8=BAxpack=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20(#9650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: Navicat移动到xpack功能 * 优化 * fix: 去掉多余的import * perf: 优化逻辑 * perf: 修改打印位置 --- apps/terminal/applets/__init__.py | 4 ++-- apps/terminal/models/applet/applet.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/terminal/applets/__init__.py b/apps/terminal/applets/__init__.py index bb09feecd..0d8e50a3b 100644 --- a/apps/terminal/applets/__init__.py +++ b/apps/terminal/applets/__init__.py @@ -11,9 +11,9 @@ def install_or_update_builtin_applets(): path = os.path.join(BASE_DIR, d) if not os.path.isdir(path) or not os.path.exists(os.path.join(path, 'manifest.yml')): continue - print("Install or update applet: {}".format(path)) try: - Applet.install_from_dir(path) + if Applet.install_from_dir(path): + print("Install or update applet: {}".format(path)) except Exception as e: print(e) diff --git a/apps/terminal/models/applet/applet.py b/apps/terminal/models/applet/applet.py index 1fd8a670f..c71fe95c2 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 jumpserver.utils import has_valid_xpack_license logger = get_logger(__name__) @@ -95,6 +96,9 @@ class Applet(JMSBaseModel): manifest = cls.validate_pkg(path) name = manifest['name'] + if not has_valid_xpack_license() and name.lower() in ('navicat', ): + return + instance = cls.objects.filter(name=name).first() serializer = AppletSerializer(instance=instance, data=manifest) serializer.is_valid() From f5d086702a4ceb76cb0e56981776e6ed7086aca5 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 21 Feb 2023 12:12:38 +0800 Subject: [PATCH 17/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8F=91=E5=B8=83=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/api/applet/host.py | 2 +- apps/terminal/models/applet/host.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/terminal/api/applet/host.py b/apps/terminal/api/applet/host.py index 40c0c6caf..38c42cd18 100644 --- a/apps/terminal/api/applet/host.py +++ b/apps/terminal/api/applet/host.py @@ -58,7 +58,7 @@ class AppletHostDeploymentViewSet(viewsets.ModelViewSet): def applets(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) - applet_id = serializer.validated_data.get('applet_id') + applet_id = serializer.validated_data.pop('applet_id') instance = serializer.save() task = run_applet_host_deployment_install_applet.delay(instance.id, applet_id) instance.save_task(task.id) diff --git a/apps/terminal/models/applet/host.py b/apps/terminal/models/applet/host.py index e179a8380..47de718df 100644 --- a/apps/terminal/models/applet/host.py +++ b/apps/terminal/models/applet/host.py @@ -10,6 +10,7 @@ from simple_history.utils import bulk_create_with_history from assets.models import Host from common.db.models import JMSBaseModel from common.utils import random_string +from terminal.const import PublishStatus __all__ = ['AppletHost', 'AppletHostDeployment'] @@ -63,11 +64,11 @@ class AppletHost(Host): status_applets = defaultdict(list) for applet in applets: if applet.name not in name_version_mapper: - status_applets['unpublished'].append(applet) + status_applets[PublishStatus.failed.value].append(applet) elif applet.version != name_version_mapper[applet.name]: - status_applets['not_match'].append(applet) + status_applets[PublishStatus.mismatch.value].append(applet) else: - status_applets['published'].append(applet) + status_applets[PublishStatus.success.value].append(applet) for status, applets in status_applets.items(): self.publications.filter(applet__in=applets) \