[ Agent ] [ Executor ] - fix bugs

This commit is contained in:
zeaslity
2023-11-07 14:28:28 +08:00
parent b17f1dcb52
commit ebe0ca916d
3 changed files with 11 additions and 4 deletions

View File

@@ -200,6 +200,9 @@ func BuildAgentOsOperator(agentServerInfo *register.AgentServerInfo) {
// 2023年8月4日 passthrough some key information
ossOfflinePrefix := g.G.AgentConfig.GetString("octopus.agent.executor.ossOfflinePrefix")
if !strings.HasSuffix(ossOfflinePrefix, "/") {
ossOfflinePrefix += "/"
}
// call the init exec function
agentOsOperator := executor.BuildAgentOsOperator(agentServerInfo.OSInfo, ossOfflinePrefix)

View File

@@ -30,7 +30,7 @@ func BuildAgentOsOperator(osInfo string, ossOfflinePrefix string) *AgentOsOperat
func detectByOsType(os *AgentOsOperator, osInfo string) {
ubuntuSsRealseCode := [][]string{
ubuntuOsReleaseCode := [][]string{
{
"cat",
"/etc/os-release",
@@ -71,8 +71,13 @@ func detectByOsType(os *AgentOsOperator, osInfo string) {
}
// os release code
osReleaseResult, _ := PipeLineCommandExecutor(ubuntuSsRealseCode)
os.AgentOSReleaseCode = osReleaseResult[0]
ok, resultLog := PipelineCommandExecutor(ubuntuOsReleaseCode)
if ok {
os.AgentOSReleaseCode = resultLog[0]
} else {
os.AgentOSReleaseCode = "UNKNOWN"
}
}
}