From a47ede755f43e8d061bd05f16987bae1ee27db5c Mon Sep 17 00:00:00 2001 From: zeaslity Date: Tue, 28 Feb 2023 21:39:33 +0800 Subject: [PATCH] =?UTF-8?q?[server][=20executor]-=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=BA=95=E5=B1=82=E7=9A=84=E4=BB=A3=E7=A0=81=20-=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/thread/CommandExecLogCache.java | 2 ++ .../rpc/controller/ExecutionController.java | 30 +++++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/agent/src/main/java/io/wdd/agent/executor/thread/CommandExecLogCache.java b/agent/src/main/java/io/wdd/agent/executor/thread/CommandExecLogCache.java index dcea5fc..039a73b 100644 --- a/agent/src/main/java/io/wdd/agent/executor/thread/CommandExecLogCache.java +++ b/agent/src/main/java/io/wdd/agent/executor/thread/CommandExecLogCache.java @@ -206,6 +206,8 @@ public class CommandExecLogCache { ArrayList commandExecCachedLog = CachedCommandLogMap.get(streamKey); + commandExecCachedLog.add(""); + commandExecCachedLog.add(""); commandExecCachedLog.add("--------------- command result are as above --------------------"); commandExecCachedLog.add(execTimeCostString); commandExecCachedLog.add(execResultString); diff --git a/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java b/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java index 5409272..c94ffdf 100644 --- a/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java +++ b/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java @@ -34,10 +34,12 @@ public class ExecutionController { SyncExecutionService syncExecutionService; @PostMapping("/command/one") - @ApiOperation("[命令] - 手动发送命令") + @ApiOperation("[命令] [异步]- 单台主机") public R patchCommandToAgent( @RequestParam(value = "topicName") @ApiParam(name = "topicName", value = "目标主机名称") String topicName, @RequestParam(value = "commandList", required = false) @Nullable List commandList, + @RequestParam(value = "completeCommandList", required = false) + @ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List> completeCommandList, @RequestParam(value = "type", required = false) @Nullable String type ) { @@ -45,47 +47,57 @@ public class ExecutionController { .SendCommandToAgent( topicName, type, - commandList + commandList, + completeCommandList, + false, + null, + false ); return R.ok(streamKey); } @PostMapping("/command/batch") - @ApiOperation("[命令] - 批量发送命令") + @ApiOperation("[命令] [异步] - 批量主机") public R> patchCommandToAgentList( @RequestParam(value = "topicNameList") @ApiParam(name = "topicNameList", value = "目标机器列表") List topicNameList, @RequestParam(value = "commandList", required = false) @ApiParam(name = "commandList", value = "命令行") @Nullable List commandList, + @RequestParam(value = "completeCommandList", required = false) + @ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List> completeCommandList, @RequestParam(value = "type", required = false) @Nullable String type ) { - return R.ok(asyncExecutionService.SendCommandToAgent( + return R.ok(asyncExecutionService.SendCommandToAgentComplete( topicNameList, type, - commandList + commandList, + completeCommandList )); } @PostMapping("/command/all") - @ApiOperation("[命令] - 发送命令至所有的主机") + @ApiOperation("[命令] [异步] - 所有的主机") public R> patchCommandToAllAgent( @RequestParam(value = "commandList", required = false) @ApiParam(name = "commandList", value = "命令行") @Nullable List commandList, + @RequestParam(value = "completeCommandList", required = false) + @ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List> completeCommandList, @RequestParam(value = "type", required = false) @Nullable String type ) { - return R.ok(asyncExecutionService.SendCommandToAgent( + return R.ok(asyncExecutionService.SendCommandToAgentComplete( ALL_AGENT_TOPIC_NAME_LIST, type, - commandList + commandList, + completeCommandList )); } @PostMapping("/command/healthy") - @ApiOperation("[命令] - 发送命令至健康的主机") + @ApiOperation("[命令] [异步] - 健康的主机") public R> patchCommandToHealthyAgent( @RequestParam(value = "commandList", required = false) @ApiParam(name = "commandList", value = "命令行") @Nullable List commandList,