🚧 修改 exitCode.

This commit is contained in:
lijiahangmax
2024-05-15 00:20:38 +08:00
parent 4fe6208d0e
commit a6209751de
16 changed files with 76 additions and 116 deletions

View File

@@ -61,8 +61,8 @@ public class ExecHostLogDO extends BaseDO {
private String parameter;
@Schema(description = "退出码")
@TableField("exit_status")
private Integer exitStatus;
@TableField("exit_code")
private Integer exitCode;
@Schema(description = "日志路径")
@TableField("log_path")

View File

@@ -50,7 +50,7 @@ public class ExecHostLogVO implements Serializable {
private String parameter;
@Schema(description = "退出码")
private Integer exitStatus;
private Integer exitCode;
@Schema(description = "错误信息")
private String errorMessage;

View File

@@ -230,7 +230,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
} else if (ExecHostStatusEnum.COMPLETED.equals(status)) {
// 完成
updateRecord.setFinishTime(new Date());
updateRecord.setExitStatus(executor.getExitCode());
updateRecord.setExitCode(executor.getExitCode());
this.exitCode = executor.getExitCode();
} else if (ExecHostStatusEnum.FAILED.equals(status)) {
// 失败

View File

@@ -149,17 +149,17 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
.append(Dates.current())
.newLine();
} else {
long ms = this.updateRecord.getFinishTime().getTime() - this.updateRecord.getStartTime().getTime();
Integer exitStatus = this.updateRecord.getExitStatus();
long ms = updateRecord.getFinishTime().getTime() - updateRecord.getStartTime().getTime();
Integer exitCode = updateRecord.getExitCode();
// 执行完成
appender.append(AnsiForeground.BRIGHT_GREEN, "< 命令执行完成 ")
.append(Dates.current())
.newLine()
.append(AnsiForeground.BRIGHT_BLUE, "exit: ");
if (ExitCode.isSuccess(exitStatus)) {
appender.append(AnsiForeground.BRIGHT_GREEN, exitStatus);
if (ExitCode.isSuccess(exitCode)) {
appender.append(AnsiForeground.BRIGHT_GREEN, exitCode);
} else {
appender.append(AnsiForeground.BRIGHT_RED, exitStatus);
appender.append(AnsiForeground.BRIGHT_RED, exitCode);
}
appender.newLine()
.append(AnsiForeground.BRIGHT_BLUE, "used: ")

View File

@@ -156,7 +156,7 @@ public class ExecLogServiceImpl implements ExecLogService {
ExecHostLogDO::getStatus,
ExecHostLogDO::getStartTime,
ExecHostLogDO::getFinishTime,
ExecHostLogDO::getExitStatus,
ExecHostLogDO::getExitCode,
ExecHostLogDO::getErrorMessage)
.in(ExecHostLogDO::getLogId, idList)
.then()

View File

@@ -12,7 +12,7 @@
<result column="status" property="status"/>
<result column="command" property="command"/>
<result column="parameter" property="parameter"/>
<result column="exit_status" property="exitStatus"/>
<result column="exit_code" property="exitCode"/>
<result column="log_path" property="logPath"/>
<result column="script_path" property="scriptPath"/>
<result column="error_message" property="errorMessage"/>
@@ -27,7 +27,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, log_id, host_id, host_name, host_address, status, command, parameter, exit_status, log_path, script_path, error_message, start_time, finish_time, create_time, update_time, creator, updater, deleted
id, log_id, host_id, host_name, host_address, status, command, parameter, exit_code, log_path, script_path, error_message, start_time, finish_time, create_time, update_time, creator, updater, deleted
</sql>
</mapper>