🔨 批量执行.
This commit is contained in:
@@ -75,6 +75,5 @@ public class ExecController {
|
||||
}
|
||||
|
||||
// TODO tail log
|
||||
// TODO parameterSchema 存储
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ public class ExecLogDO extends BaseDO {
|
||||
@TableField("command")
|
||||
private String command;
|
||||
|
||||
@Schema(description = "参数 schema")
|
||||
@TableField("parameter_schema")
|
||||
private String parameterSchema;
|
||||
|
||||
@Schema(description = "超时时间")
|
||||
@TableField("timeout")
|
||||
private Integer timeout;
|
||||
|
||||
@@ -38,6 +38,10 @@ public class ExecCommandRequest {
|
||||
@Schema(description = "执行参数")
|
||||
private String parameter;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "参数 schema")
|
||||
private String parameterSchema;
|
||||
|
||||
@NotEmpty
|
||||
@Schema(description = "执行主机")
|
||||
private List<Long> hostIdList;
|
||||
|
||||
@@ -40,6 +40,9 @@ public class ExecLogVO implements Serializable {
|
||||
@Schema(description = "执行命令")
|
||||
private String command;
|
||||
|
||||
@Schema(description = "参数 schema")
|
||||
private String parameterSchema;
|
||||
|
||||
@Schema(description = "超时时间")
|
||||
private Integer timeout;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.ops.module.asset.handler.host.exec.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.exception.AuthenticationException;
|
||||
import com.orion.lang.exception.ConnectionRuntimeException;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
import com.orion.lang.support.timeout.TimeoutChecker;
|
||||
import com.orion.lang.utils.Strings;
|
||||
@@ -82,7 +83,6 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
||||
}
|
||||
// 执行回调
|
||||
if (this.interrupted) {
|
||||
// TODO 测试
|
||||
// 中断执行
|
||||
this.updateStatus(ExecHostStatusEnum.INTERRUPTED, null);
|
||||
} else if (ex != null) {
|
||||
@@ -192,6 +192,8 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
||||
message = "执行超时";
|
||||
} else if (ex instanceof InvalidArgumentException) {
|
||||
message = ex.getMessage();
|
||||
} else if (ex instanceof ConnectionRuntimeException) {
|
||||
message = "连接失败";
|
||||
} else if (ex instanceof AuthenticationException) {
|
||||
message = "认证失败";
|
||||
} else {
|
||||
|
||||
@@ -102,6 +102,7 @@ public class ExecServiceImpl implements ExecService {
|
||||
.source(ExecSourceEnum.BATCH.name())
|
||||
.description(Strings.ifBlank(request.getDescription(), Strings.retain(command, 60) + Const.OMIT))
|
||||
.command(command)
|
||||
.parameterSchema(request.getParameterSchema())
|
||||
.timeout(request.getTimeout())
|
||||
.status(ExecStatusEnum.WAITING.name())
|
||||
.build();
|
||||
@@ -159,6 +160,7 @@ public class ExecServiceImpl implements ExecService {
|
||||
.timeout(execLog.getTimeout())
|
||||
.command(execLog.getCommand())
|
||||
.parameter(hostLogs.get(0).getParameter())
|
||||
.parameterSchema(execLog.getParameterSchema())
|
||||
.hostIdList(hostIdList)
|
||||
.build();
|
||||
return this.execCommand(request);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<result column="source_id" property="sourceId"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="command" property="command"/>
|
||||
<result column="parameter_schema" property="parameterSchema"/>
|
||||
<result column="timeout" property="timeout"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="start_time" property="startTime"/>
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, username, source, source_id, description, command, timeout, status, start_time, finish_time, create_time, update_time, creator, updater, deleted
|
||||
id, user_id, username, source, source_id, description, command, parameter_schema, timeout, status, start_time, finish_time, create_time, update_time, creator, updater, deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user