From ebe0ca916dc4550e6c77d1cb2edb1a1b55d525de Mon Sep 17 00:00:00 2001 From: zeaslity Date: Tue, 7 Nov 2023 14:28:28 +0800 Subject: [PATCH] [ Agent ] [ Executor ] - fix bugs --- agent-go/AgentInitialization.go | 3 +++ agent-go/executor/InitFunction.go | 11 ++++++++--- .../java/io/wdd/rpc/init/AcceptAgentInitInfo.java | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/agent-go/AgentInitialization.go b/agent-go/AgentInitialization.go index b293f9e..1a9e3cc 100644 --- a/agent-go/AgentInitialization.go +++ b/agent-go/AgentInitialization.go @@ -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) diff --git a/agent-go/executor/InitFunction.go b/agent-go/executor/InitFunction.go index 4703fd8..7a5653f 100644 --- a/agent-go/executor/InitFunction.go +++ b/agent-go/executor/InitFunction.go @@ -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" + } + } } diff --git a/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java b/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java index 206e5ac..6b84d93 100644 --- a/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java +++ b/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java @@ -309,7 +309,6 @@ public class AcceptAgentInitInfo { private boolean validateServerInfo(ServerInfoVO serverInfoVO) { - log.info("server info validated success !"); return true; }