diff --git a/docs/about/change-log.md b/docs/about/change-log.md index 8ee9677e..9ce8c8b5 100644 --- a/docs/about/change-log.md +++ b/docs/about/change-log.md @@ -12,6 +12,7 @@ * 🐞 修复 主机分组授权页面刷新不显示 loading * 🐞 修复 面包屑组件路径显示不全的问题 * 🐞 修复 数据字典历史提示无权限 +* 🐞 修复 批量执行较短命令日志不显示 * 🩰 修改 主机终端亮色模式配色 * 🩰 修改 执行模板 UI 修改 * 🌈 新增 计划任务模块 diff --git a/docs/update/v1.0.0.md b/docs/update/v1.0.0.md index 9455a356..bc76c6db 100644 --- a/docs/update/v1.0.0.md +++ b/docs/update/v1.0.0.md @@ -3,7 +3,12 @@ > sql 脚本 - DML ```sql +-- 字典配置项 +DELETE FROM `dict_key` WHERE id >= 32; INSERT INTO `dict_key` VALUES (32, 'terminalTabColor', 'COLOR', '[]', '终端标签页颜色', '2024-03-01 15:01:44', '2024-03-01 15:01:44', '1', '1', 0); + +-- 字典配置值 +DELETE FROM `dict_value` WHERE id >= 203; INSERT INTO `dict_value` VALUES (203, 32, 'terminalTabColor', 'rgb(var(--red-6))', '红色', '{}', 10, '2024-03-01 15:07:41', '2024-03-01 15:07:41', '1', '1', 0); INSERT INTO `dict_value` VALUES (204, 32, 'terminalTabColor', 'rgb(var(--orange-6))', '橙色', '{}', 20, '2024-03-01 15:07:55', '2024-03-01 15:07:55', '1', '1', 0); INSERT INTO `dict_value` VALUES (205, 32, 'terminalTabColor', 'rgb(var(--yellow-6))', '黄色', '{}', 30, '2024-03-01 15:08:13', '2024-03-01 15:08:13', '1', '1', 0); diff --git a/docs/update/v1.0.1.md b/docs/update/v1.0.1.md index ce4cd8cd..f16d863b 100644 --- a/docs/update/v1.0.1.md +++ b/docs/update/v1.0.1.md @@ -11,7 +11,7 @@ ALTER TABLE `operator_log` ADD INDEX `idx_type`(`type`); ```sql -- 菜单配置 -DELETE FROM `system_menu` WHERE id IN (148, 149); +DELETE FROM `system_menu` WHERE id >= 148; INSERT INTO `system_menu` VALUES (148, 152, '连接日志', NULL, 2, 10, 1, 1, 1, 0, 'IconLink', NULL, 'assetAuditConnectLog', '2023-12-26 22:53:07', '2024-03-05 23:31:23', '1', '1', 0); INSERT INTO `system_menu` VALUES (149, 148, '查询连接日志', 'asset:host-connect-log:management:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2023-12-26 22:53:08', '2024-03-04 13:40:42', '1', '1', 0); INSERT INTO `system_menu` VALUES (152, 0, '运维审计', NULL, 1, 410, 1, 1, 1, 0, 'IconSafe', NULL, 'assetAudit', '2024-01-04 17:54:56', '2024-03-05 23:31:10', '1', '1', 0); @@ -25,9 +25,11 @@ INSERT INTO `system_menu` VALUES (159, 158, '查询 SFTP 操作日志', 'asset:h INSERT INTO `system_menu` VALUES (160, 158, '删除 SFTP 操作日志', 'asset:host-sftp-log:management:delete', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-05 15:31:17', '2024-03-05 15:57:30', '1', '1', 0); -- 字典配置项 +DELETE FROM `dict_key` WHERE id >= 33; INSERT INTO `dict_key` VALUES (33, 'sftpOperatorType', 'STRING', '[]', 'SFTP 操作类型', '2024-03-05 16:49:54', '2024-03-05 16:49:54', '1', '1', 0); -- 字典配置值 +DELETE FROM `dict_value` WHERE id >= 214; INSERT INTO `dict_value` VALUES (214, 28, 'hostConnectStatus', 'FORCE_OFFLINE', '强制下线', '{\"color\": \"rgb(var(--red-6))\"}', 40, '2024-03-04 12:51:13', '2024-03-04 12:51:13', '1', '1', 0); INSERT INTO `dict_value` VALUES (215, 1, 'operatorLogModule', 'asset:host-connect-log', '主机连接日志', '{}', 2060, '2024-03-04 13:43:33', '2024-03-04 13:43:33', '1', '1', 0); INSERT INTO `dict_value` VALUES (216, 2, 'operatorLogType', 'host-connect-log:delete', '删除记录', '{}', 10, '2024-03-04 13:44:34', '2024-03-04 13:44:34', '1', '1', 0); diff --git a/docs/update/v1.0.4.md b/docs/update/v1.0.4.md index 20f7672c..2d43e913 100644 --- a/docs/update/v1.0.4.md +++ b/docs/update/v1.0.4.md @@ -388,9 +388,8 @@ DELETE FROM `dict_key` WHERE `id` >= 36; INSERT INTO `dict_key` VALUES (36, 'execJobStatus', 'INTEGER', '[{\"name\": \"color\", \"type\": \"COLOR\"}]', '计划任务状态', '2024-04-10 16:18:07', '2024-04-11 14:25:05', '1', '1', 0); -- 字典配置值 -DELETE FROM `dict_value` WHERE `id` = 222; +DELETE FROM `dict_value` WHERE `id` = 222 OR >= 233; INSERT INTO `dict_value` VALUES (222, 2, 'operatorLogType', 'host-terminal:delete-sftp-log', '删除文件操作日志', '{}', 15, '2024-03-05 15:28:00', '2024-04-12 13:47:36', '1', '1', 0); -DELETE FROM `dict_value` WHERE `id` >= 233; INSERT INTO `dict_value` VALUES (233, 2, 'operatorLogType', 'exec-template:create', '创建执行模板', '{}', 10, '2024-03-07 18:32:41', '2024-04-12 13:48:54', '1', '1', 0); INSERT INTO `dict_value` VALUES (234, 2, 'operatorLogType', 'exec-template:update', '更新执行模板', '{}', 20, '2024-03-07 18:32:41', '2024-04-12 13:48:56', '1', '1', 0); INSERT INTO `dict_value` VALUES (235, 2, 'operatorLogType', 'exec-template:delete', '删除执行模板', '{}', 30, '2024-03-07 18:32:41', '2024-04-12 13:49:01', '1', '1', 0); diff --git a/docs/update/v1.0.5.md b/docs/update/v1.0.5.md new file mode 100644 index 00000000..12cda601 --- /dev/null +++ b/docs/update/v1.0.5.md @@ -0,0 +1,11 @@ +## v1.0.5 + +> sql 脚本 - DDL + +```sql +``` + +> sql 脚本 - DML + +```sql +``` diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecCommandHandler.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecCommandHandler.java index e46a8479..137fa8dd 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecCommandHandler.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecCommandHandler.java @@ -179,9 +179,9 @@ public class ExecCommandHandler implements IExecCommandHandler { return; } this.closed = true; + Streams.close(logOutputStream); Streams.close(executor); Streams.close(sessionStore); - Streams.close(logOutputStream); execLogManager.asyncCloseTailFile(execHostCommand.getLogPath()); } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java index de98bda7..02150b59 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java @@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j; import java.util.Date; import java.util.List; -import java.util.stream.Collectors; /** * 命令执行任务 @@ -40,7 +39,7 @@ public class ExecTaskHandler implements IExecTaskHandler { private TimeoutChecker timeoutChecker; @Getter - private List handlers; + private final List handlers; public ExecTaskHandler(ExecCommandDTO execCommand) { this.execCommand = execCommand; @@ -93,11 +92,13 @@ public class ExecTaskHandler implements IExecTaskHandler { } if (hosts.size() == 1) { // 单个主机直接执行 - new ExecCommandHandler(hosts.get(0), timeoutChecker).run(); + ExecCommandHandler handler = new ExecCommandHandler(hosts.get(0), timeoutChecker); + handlers.add(handler); + handler.run(); } else { - this.handlers = hosts.stream() + hosts.stream() .map(s -> new ExecCommandHandler(s, timeoutChecker)) - .collect(Collectors.toList()); + .forEach(handlers::add); // 多个主机异步阻塞执行 Threads.blockRun(handlers, AssetThreadPools.EXEC_HOST); } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/constant/LogConst.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/constant/LogConst.java index a3118ab4..14838dbe 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/constant/LogConst.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/constant/LogConst.java @@ -19,6 +19,6 @@ public interface LogConst { int TRACKER_DELAY_MS = 200; - int TRACKER_WAIT_TIMES = 10; + int TRACKER_WAIT_TIMES = 100; } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java index 934ed8ec..db74d8b8 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java @@ -55,10 +55,11 @@ public class ExecLogTracker implements IExecLogTracker { tracker.notFoundMode(FileNotFoundMode.WAIT_COUNT, LogConst.TRACKER_WAIT_TIMES); // 开始监听文件 tracker.run(); - // 监听完成回调 - this.close = true; } catch (Exception e) { log.error("exec log tracker error path: {}", absolutePath, e); + } finally { + // 释放资源 + this.close(); } }