[Excution] - base function accomplish - 4

This commit is contained in:
IceDerce
2023-06-26 13:50:14 +08:00
parent 80198930c4
commit 97187363cc
6 changed files with 88 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"agent-go/executor"
"agent-go/g"
"agent-go/rabbitmq"
"agent-go/register"
@@ -184,5 +185,27 @@ func parseAgentServerInfo() *register.AgentServerInfo {
}
log.Info(fmt.Sprintf("agent server info is %v", string(jsonFormat)))
// build a operator cache
BuildAgentOsOperator(agentServerInfo)
return agentServerInfo
}
func BuildAgentOsOperator(agentServerInfo *register.AgentServerInfo) {
executor.AgentOsOperatorCache = &executor.AgentOsOperator{
InstallCommandPrefix: nil,
RemoveCommandPrefix: nil,
CanAccessInternet: false,
IsOsTypeUbuntu: false,
IsAgentInnerWall: false,
AgentArch: "",
AgentOSReleaseCode: "",
AgentServerInfo: agentServerInfo,
}
// debug
marshal, _ := json.Marshal(executor.AgentOsOperatorCache)
log.DebugF("cached agent operator is %s", marshal)
}