Merge remote-tracking branch 'origin/local-ss' into local-ss
This commit is contained in:
@@ -28,20 +28,20 @@ func INIT(octopusAgentConfigFileName string, agentServerInfoConf string) chan bo
|
||||
agentServerInfo := parseAgentServerInfo(agentServerInfoConf)
|
||||
// todo totally get from a_status module
|
||||
|
||||
// 初始化Nacos的连接配置
|
||||
agentConfig := parseOctopusAgentConf(octopusAgentConfigFileName)
|
||||
a_agent.AgentConfig = agentConfig
|
||||
|
||||
// re-get agentInfo from status module
|
||||
agentInfo := a_status.ReportAgentInfo()
|
||||
refreshAgentInfoByStatusInfo(agentInfo, agentServerInfo)
|
||||
|
||||
// build operator cache
|
||||
BuildAgentOsOperator(agentInfo, agentServerInfo)
|
||||
buildAgentOsOperator(agentInfo, agentServerInfo)
|
||||
|
||||
// 缓存此内容
|
||||
a_agent.AgentServerInfoCache = agentServerInfo
|
||||
|
||||
// 初始化Nacos的连接配置
|
||||
agentConfig := ParseConfiguration(octopusAgentConfigFileName)
|
||||
a_agent.AgentConfig = agentConfig
|
||||
|
||||
// build for octopus tcp connect info struct
|
||||
rabbitTCPConnectInfo := BuildOctopusTCPConnect(agentConfig)
|
||||
|
||||
@@ -179,24 +179,18 @@ func buildAndSendInitMsgToServer(agentServerInfo *a_agent.AgentServerInfo, initT
|
||||
initOmType,
|
||||
agentServerInfo,
|
||||
)
|
||||
msgBytes, err := json.Marshal(octopusMsg)
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("octopus message convert to json is wrong! msg is => %v", octopusMsg))
|
||||
}
|
||||
|
||||
// 发送OM至MQ中
|
||||
P.Submit(
|
||||
_ = P.Submit(
|
||||
func() {
|
||||
for g.G.AgentHasRegister == false {
|
||||
|
||||
log.Debug(fmt.Sprintf("Send init message to server! ==> %s", string(msgBytes)))
|
||||
log.InfoF("Send init message to server! ==> %s", octopusMsg)
|
||||
|
||||
//如果agent存活 而Server不存活 那么需要持续不断的向Server中发送消息
|
||||
initToServerQueue.Send(
|
||||
msgBytes,
|
||||
)
|
||||
initToServerQueue.SendOMsg(octopusMsg)
|
||||
// 休眠
|
||||
time.Sleep(10 * time.Minute)
|
||||
time.Sleep(5 * time.Minute)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -341,7 +335,7 @@ func UniformAgentServerInfo(agentServerInfo *a_agent.AgentServerInfo) {
|
||||
|
||||
}
|
||||
|
||||
func BuildAgentOsOperator(agentInfo *a_status.AgentInfo, agentServerInfo *a_agent.AgentServerInfo) {
|
||||
func buildAgentOsOperator(agentInfo *a_status.AgentInfo, agentServerInfo *a_agent.AgentServerInfo) {
|
||||
|
||||
// 2023年8月4日 pass through some key information
|
||||
ossOfflinePrefix := "http://bastion.io"
|
||||
@@ -350,6 +344,8 @@ func BuildAgentOsOperator(agentInfo *a_status.AgentInfo, agentServerInfo *a_agen
|
||||
if !strings.HasSuffix(ossOfflinePrefix, "/") {
|
||||
ossOfflinePrefix += "/"
|
||||
}
|
||||
} else {
|
||||
log.WarnF("buildAgentOsOperator - agent oss offline prefix is null !")
|
||||
}
|
||||
|
||||
// call the init exec function
|
||||
|
||||
@@ -42,7 +42,7 @@ func BastionModeInit() {
|
||||
// re-get agentInfo from status module
|
||||
agentInfo := a_status.ReportAgentInfo()
|
||||
refreshAgentInfoByStatusInfo(agentInfo, agentServerInfo)
|
||||
BuildAgentOsOperator(agentInfo, agentServerInfo)
|
||||
buildAgentOsOperator(agentInfo, agentServerInfo)
|
||||
|
||||
// install docker
|
||||
agentOsOperator := a_executor.AgentOsOperatorCache
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func ParseConfiguration(configFileName string) *viper.Viper {
|
||||
func parseOctopusAgentConf(configFileName string) *viper.Viper {
|
||||
|
||||
agentConfig := parseAgentConfigFile(configFileName, nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user