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,