[Excution] - base function accomplish union code - 1

This commit is contained in:
IceDerce
2023-06-27 15:13:48 +08:00
parent ca255e1b3f
commit 44ce0959d9
3 changed files with 19 additions and 13 deletions

View File

@@ -80,7 +80,7 @@ func INIT() *register.AgentServerInfo {
initFromServerQueue := &rabbitmq.RabbitQueue{
RabbitProp: initFromServerProp,
}
defer initFromServerQueue.Close()
//defer initFromServerQueue.Close()
// 建立连接
initFromServerQueue.Connect()
@@ -113,7 +113,10 @@ func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToSe
var serverInfo register.AgentServerInfo
s, _ := initOctopusMsg.Content.(string)
s, er := initOctopusMsg.Content.(string)
if !er {
log.ErrorF("convet to string error! => %v", er)
}
cc := json.Unmarshal([]byte(s), &serverInfo)
if cc != nil {
log.Error(fmt.Sprintf("parse init message from server wroong, message is => %v ", cc))
@@ -194,14 +197,16 @@ func parseAgentServerInfo() *register.AgentServerInfo {
func BuildAgentOsOperator(agentServerInfo *register.AgentServerInfo) {
executor.AgentOsOperatorCache = &executor.AgentOsOperator{
InstallCommandPrefix: nil,
RemoveCommandPrefix: nil,
CanAccessInternet: false,
IsOsTypeUbuntu: false,
IsAgentInnerWall: false,
AgentArch: "",
AgentOSReleaseCode: "",
AgentServerInfo: agentServerInfo,
InstallCommandPrefix: []string{
"apt-get", "install", "-y",
},
RemoveCommandPrefix: []string{"apt", "remove", "-y"},
CanAccessInternet: true,
IsOsTypeUbuntu: true,
IsAgentInnerWall: true,
AgentArch: "amd64",
AgentOSReleaseCode: "focal",
AgentServerInfo: agentServerInfo,
}
// debug