🔨 执行日志.
This commit is contained in:
@@ -8,7 +8,7 @@ Authorization: {{token}}
|
||||
"timeout": 10,
|
||||
"command": "echo 这是日志@{{ hostAddress }}\nsleep 1\necho @{{ hostName }}",
|
||||
"parameterSchema": "[]",
|
||||
"hostIdList": [1,7]
|
||||
"hostIdList": [1]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ExecController {
|
||||
}
|
||||
|
||||
@PostMapping("/tail-log")
|
||||
@Operation(summary = "查看批量执行日志")
|
||||
@Operation(summary = "查看执行日志")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec:exec-command', 'asset:exec-log:query')")
|
||||
public String getExecLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
|
||||
return execService.getExecLogTailToken(request);
|
||||
@@ -85,9 +85,9 @@ public class ExecController {
|
||||
|
||||
@OperatorLog(ExecOperatorType.DOWNLOAD_HOST_LOG)
|
||||
@GetMapping("/download-log")
|
||||
@Operation(summary = "下载执行日志文件")
|
||||
@Operation(summary = "下载执行日志")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec:exec-command', 'asset:exec-log:query')")
|
||||
public void downloadLogFile(@RequestParam("id") Long id, HttpServletResponse response) {
|
||||
public void downloadExecLogFile(@RequestParam("id") Long id, HttpServletResponse response) {
|
||||
execService.downloadLogFile(id, response);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ public class ExecCommandVO implements Serializable {
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "执行状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "主机 id 映射")
|
||||
private List<ExecCommandHostVO> hosts;
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
||||
log.info("ExecCommandHandler.updateStatus finish id: {}, effect: {}", id, effect);
|
||||
}
|
||||
|
||||
// TODO timeout
|
||||
|
||||
@Override
|
||||
public void write(String msg) {
|
||||
this.executor.write(msg);
|
||||
|
||||
@@ -167,6 +167,7 @@ public class ExecServiceImpl implements ExecService {
|
||||
.collect(Collectors.toList());
|
||||
return ExecCommandVO.builder()
|
||||
.id(execId)
|
||||
.status(execLog.getStatus())
|
||||
.hosts(hostResult)
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user