diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index cf3c41fc8..3826532e5 100644 Binary files a/apps/locale/zh/LC_MESSAGES/django.mo and b/apps/locale/zh/LC_MESSAGES/django.mo differ diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 92e081d08..38712017a 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Jumpserver 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-16 17:58+0800\n" +"POT-Creation-Date: 2019-01-21 17:40+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: ibuler \n" "Language-Team: Jumpserver team\n" @@ -120,7 +120,7 @@ msgstr "端口" #: perms/templates/perms/asset_permission_create_update.html:45 #: perms/templates/perms/asset_permission_list.html:56 #: perms/templates/perms/asset_permission_list.html:125 -#: terminal/backends/command/models.py:13 terminal/models.py:143 +#: terminal/backends/command/models.py:13 terminal/models.py:155 #: terminal/templates/terminal/command_list.html:40 #: terminal/templates/terminal/command_list.html:73 #: terminal/templates/terminal/session_list.html:41 @@ -158,8 +158,8 @@ msgstr "不能包含特殊字符" #: perms/templates/perms/asset_permission_detail.html:62 #: perms/templates/perms/asset_permission_list.html:53 #: perms/templates/perms/asset_permission_list.html:72 -#: perms/templates/perms/asset_permission_user.html:54 terminal/models.py:21 -#: terminal/models.py:212 terminal/templates/terminal/terminal_detail.html:43 +#: perms/templates/perms/asset_permission_user.html:54 terminal/models.py:22 +#: terminal/models.py:233 terminal/templates/terminal/terminal_detail.html:43 #: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:14 #: users/models/user.py:55 users/templates/users/_select_user_modal.html:13 #: users/templates/users/user_detail.html:63 @@ -427,7 +427,7 @@ msgstr "创建日期" #: assets/templates/assets/user_asset_list.html:159 common/models.py:34 #: ops/models/adhoc.py:43 orgs/models.py:17 perms/models.py:39 #: perms/models.py:92 perms/templates/perms/asset_permission_detail.html:102 -#: terminal/models.py:31 terminal/templates/terminal/terminal_detail.html:63 +#: terminal/models.py:32 terminal/templates/terminal/terminal_detail.html:63 #: users/models/group.py:15 users/models/user.py:88 #: users/templates/users/user_detail.html:127 #: users/templates/users/user_group_detail.html:67 @@ -461,7 +461,7 @@ msgstr "可连接" #: assets/models/asset.py:119 assets/models/base.py:36 msgid "Unknown" -msgstr "" +msgstr "未知" #: assets/models/base.py:25 msgid "SSH private key" @@ -534,7 +534,7 @@ msgid "Regex" msgstr "正则表达式" #: assets/models/cmd_filter.py:36 ops/models/command.py:21 -#: ops/templates/ops/command_execution_list.html:60 terminal/models.py:149 +#: ops/templates/ops/command_execution_list.html:60 terminal/models.py:161 #: terminal/templates/terminal/command_list.html:55 #: terminal/templates/terminal/command_list.html:71 #: terminal/templates/terminal/session_detail.html:48 @@ -638,7 +638,7 @@ msgstr "默认资产组" #: perms/templates/perms/asset_permission_create_update.html:41 #: perms/templates/perms/asset_permission_list.html:54 #: perms/templates/perms/asset_permission_list.html:119 templates/index.html:87 -#: terminal/backends/command/models.py:12 terminal/models.py:142 +#: terminal/backends/command/models.py:12 terminal/models.py:154 #: terminal/templates/terminal/command_list.html:32 #: terminal/templates/terminal/command_list.html:72 #: terminal/templates/terminal/session_list.html:33 @@ -726,7 +726,7 @@ msgstr "登录模式" #: perms/templates/perms/asset_permission_list.html:58 #: perms/templates/perms/asset_permission_list.html:79 #: perms/templates/perms/asset_permission_list.html:131 templates/_nav.html:25 -#: terminal/backends/command/models.py:14 terminal/models.py:144 +#: terminal/backends/command/models.py:14 terminal/models.py:156 #: terminal/templates/terminal/command_list.html:48 #: terminal/templates/terminal/command_list.html:74 #: terminal/templates/terminal/session_list.html:49 @@ -1661,7 +1661,7 @@ msgstr "系统用户资产" #: audits/templates/audits/ftp_log_list.html:73 #: audits/templates/audits/operate_log_list.html:70 #: audits/templates/audits/password_change_log_list.html:52 -#: terminal/models.py:146 terminal/templates/terminal/session_list.html:74 +#: terminal/models.py:158 terminal/templates/terminal/session_list.html:74 #: terminal/templates/terminal/terminal_detail.html:47 msgid "Remote addr" msgstr "远端地址" @@ -1704,7 +1704,7 @@ msgstr "修改者" #: ops/templates/ops/adhoc_history_detail.html:61 #: ops/templates/ops/command_execution_list.html:65 #: ops/templates/ops/task_history.html:58 perms/models.py:35 -#: perms/templates/perms/asset_permission_detail.html:86 terminal/models.py:153 +#: perms/templates/perms/asset_permission_detail.html:86 terminal/models.py:165 #: terminal/templates/terminal/session_list.html:78 msgid "Date start" msgstr "开始日期" @@ -1836,10 +1836,6 @@ msgstr "创建成功" msgid "Delete succeed" msgstr "删除成功" -#: common/api.py:221 -msgid "Waiting ...\n" -msgstr "" - #: common/const.py:6 #, python-format msgid "%(name)s was created successfully" @@ -2218,7 +2214,7 @@ msgid "Password check rule" msgstr "密码校验规则" #: common/templates/common/terminal_setting.html:76 terminal/forms.py:27 -#: terminal/models.py:25 +#: terminal/models.py:26 msgid "Command storage" msgstr "命令存储" @@ -2235,7 +2231,7 @@ msgid "Add" msgstr "添加" #: common/templates/common/terminal_setting.html:98 terminal/forms.py:32 -#: terminal/models.py:26 +#: terminal/models.py:27 msgid "Replay storage" msgstr "录像存储" @@ -2324,6 +2320,14 @@ msgstr "Become" msgid "Create by" msgstr "创建者" +#: ops/models/adhoc.py:223 +msgid "{} Start task: {}" +msgstr "{} 任务开始: {}" + +#: ops/models/adhoc.py:226 +msgid "{} Task finish" +msgstr "{} 任务结束" + #: ops/models/adhoc.py:324 msgid "Start time" msgstr "开始时间" @@ -3073,55 +3077,55 @@ msgstr "" "录像文件支持存储到服务器端硬盘、AWS S3、 阿里云 OSS 中,默认存储到服务器端硬" "盘, 更多查看文档" -#: terminal/models.py:22 +#: terminal/models.py:23 msgid "Remote Address" msgstr "远端地址" -#: terminal/models.py:23 +#: terminal/models.py:24 msgid "SSH Port" msgstr "SSH端口" -#: terminal/models.py:24 +#: terminal/models.py:25 msgid "HTTP Port" msgstr "HTTP端口" -#: terminal/models.py:113 +#: terminal/models.py:125 msgid "Session Online" msgstr "在线会话" -#: terminal/models.py:114 +#: terminal/models.py:126 msgid "CPU Usage" msgstr "CPU使用" -#: terminal/models.py:115 +#: terminal/models.py:127 msgid "Memory Used" msgstr "内存使用" -#: terminal/models.py:116 +#: terminal/models.py:128 msgid "Connections" msgstr "连接数" -#: terminal/models.py:117 +#: terminal/models.py:129 msgid "Threads" msgstr "线程数" -#: terminal/models.py:118 +#: terminal/models.py:130 msgid "Boot Time" msgstr "运行时间" -#: terminal/models.py:148 terminal/templates/terminal/session_list.html:104 +#: terminal/models.py:160 terminal/templates/terminal/session_list.html:104 msgid "Replay" msgstr "回放" -#: terminal/models.py:152 +#: terminal/models.py:164 msgid "Date last active" msgstr "最后活跃日期" -#: terminal/models.py:154 +#: terminal/models.py:166 msgid "Date end" msgstr "结束日期" -#: terminal/models.py:213 +#: terminal/models.py:234 msgid "Args" msgstr "参数" diff --git a/apps/ops/ansible/callback.py b/apps/ops/ansible/callback.py index 16e220e57..02004285a 100644 --- a/apps/ops/ansible/callback.py +++ b/apps/ops/ansible/callback.py @@ -118,18 +118,6 @@ class AdHocResultCallback(CallbackMixin, CallbackModule, CMDCallBackModule): self.gather_result("unreachable", result) super().v2_runner_on_unreachable(result) - def on_playbook_start(self, name): - date_start = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - self.display( - "{} Start task: {}\r\n".format(date_start, name) - ) - - def on_playbook_end(self, name): - date_finished = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - self.display( - "{} Task finish\r\n".format(date_finished) - ) - def display_skipped_hosts(self): pass diff --git a/apps/ops/models/adhoc.py b/apps/ops/models/adhoc.py index cedbbb4ff..e9d264ed1 100644 --- a/apps/ops/models/adhoc.py +++ b/apps/ops/models/adhoc.py @@ -220,10 +220,10 @@ class AdHoc(models.Model): time_start = time.time() try: date_start = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - print("{} Start task: {}\r\n".format(date_start, self.task.name)) + print(_("{} Start task: {}").format(date_start, self.task.name)) raw, summary = self._run_only() date_end = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - print("\r\n{} Task finished".format(date_end)) + print(_("{} Task finish").format(date_end)) history.is_finished = True if summary.get('dark'): history.is_success = False @@ -235,7 +235,6 @@ class AdHoc(models.Model): except Exception as e: return {}, {"dark": {"all": str(e)}, "contacted": []} finally: - # f.close() history.date_finished = timezone.now() history.timedelta = time.time() - time_start history.save() diff --git a/apps/ops/utils.py b/apps/ops/utils.py index d52f9c743..4a7def4fa 100644 --- a/apps/ops/utils.py +++ b/apps/ops/utils.py @@ -48,7 +48,7 @@ def update_or_create_ansible_task( hosts_same = old_hosts == new_hosts if not adhoc or adhoc != new_adhoc or not hosts_same: - logger.info(_("Update task content: {}").format(task_name)) + logger.debug(_("Update task content: {}").format(task_name)) new_adhoc.save() new_adhoc.hosts.set(hosts) task.latest_adhoc = new_adhoc diff --git a/apps/terminal/serializers/v1.py b/apps/terminal/serializers/v1.py index d36a5cb8b..adf75c936 100644 --- a/apps/terminal/serializers/v1.py +++ b/apps/terminal/serializers/v1.py @@ -9,7 +9,7 @@ from ..models import Terminal, Status, Session, Task class TerminalSerializer(serializers.ModelSerializer): session_online = serializers.SerializerMethodField() - is_alive = serializers.BooleanField() + is_alive = serializers.BooleanField(read_only=True) class Meta: model = Terminal @@ -25,7 +25,7 @@ class TerminalSerializer(serializers.ModelSerializer): class SessionSerializer(BulkSerializerMixin, serializers.ModelSerializer): - command_amount = serializers.IntegerField() + command_amount = serializers.IntegerField(read_only=True) class Meta: model = Session