[ Agent ] [ Executor ] - fix bugs

This commit is contained in:
zeaslity
2023-10-24 11:41:46 +08:00
parent 4afb62f7cf
commit 1224dd8def
3 changed files with 17 additions and 4 deletions

View File

@@ -29,15 +29,26 @@ func Execute(em *ExecutionMessage) ([]string, error) {
var resultLog []string var resultLog []string
var err error var err error
var realCommand [][]string var realCommand [][]string
ok := true
if strings.HasPrefix(em.Type, "BASE") { if strings.HasPrefix(em.Type, "BASE") {
// base function // base function
resultLog = AgentOsOperatorCache.Command(em.FuncContent[0], em.FuncContent[1:]...) if len(em.FuncContent) > 1 {
err = nil ok, resultLog = AgentOsOperatorCache.Exec(em.FuncContent[0], em.FuncContent[1:]...)
} else {
ok, resultLog = AgentOsOperatorCache.Exec(em.FuncContent[0])
}
if ok {
return resultLog, nil
}
} else if strings.HasPrefix(em.Type, "APP") { } else if strings.HasPrefix(em.Type, "APP") {
// app function // app function
ok, resultLog := AgentOsOperatorCache.Deploy(em.FuncContent[0], em.FuncContent[1:]...) if len(em.FuncContent) > 1 {
ok, resultLog = AgentOsOperatorCache.Deploy(em.FuncContent[0], em.FuncContent[1:]...)
} else {
ok, resultLog = AgentOsOperatorCache.Deploy(em.FuncContent[0])
}
if ok { if ok {
return resultLog, nil return resultLog, nil
} else { } else {

View File

@@ -42,6 +42,7 @@ type OctopusMessage struct {
func (om *OctopusMessage) Handle() { func (om *OctopusMessage) Handle() {
// 实际执行 OM handle进程 // 实际执行 OM handle进程
log.Debug("接收到OctopusMessage,开始处理!")
doHandleOctopusMessage(om) doHandleOctopusMessage(om)
} }
@@ -116,6 +117,7 @@ func agentOMHandler(octopusMessage *OctopusMessage) {
} }
func executorOMHandler(octopusMessage *OctopusMessage) { func executorOMHandler(octopusMessage *OctopusMessage) {
log.Debug("开始处理 Executor Octopus Message !")
// 转换类型 // 转换类型
executionMsgString := octopusMessage.Content.(string) executionMsgString := octopusMessage.Content.(string)

View File

@@ -277,7 +277,7 @@ CheckAndDownloadLatestVersion() {
echo "" echo ""
colorEcho $BLUE "start to download the agent config!" colorEcho $BLUE "start to download the agent config!"
agentConfigFileList=$(curl $AgentConfigUrl | grep -v h1 | grep "a href=" | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-) agentConfigFileList=$(curl "$AgentConfigUrl/" | grep -v h1 | grep "a href=" | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-)
for agentConfig in "${agentConfigFileList[@]}"; do for agentConfig in "${agentConfigFileList[@]}"; do
colorEcho $BLUE "agent config file is => $agentConfig" colorEcho $BLUE "agent config file is => $agentConfig"