修复自动化部署条件分支后的节点无法到达的问题

修复ssh测试不兼容IPv6的问题
pull/193/head
zhangchenhao 2025-05-26 14:23:33 +08:00
parent d3f9b05335
commit 85eaf5d4c0
2 changed files with 11 additions and 1 deletions

View File

@ -273,7 +273,14 @@ func SSHAPITest(providerID string) error {
default: default:
port = "22" port = "22"
} }
IPtype := public.CheckIPType(providerConfig.Host)
if IPtype == "IPv6" {
providerConfig.Host = "[" + providerConfig.Host + "]"
}
addr := fmt.Sprintf("%s:%s", providerConfig.Host, port) addr := fmt.Sprintf("%s:%s", providerConfig.Host, port)
if providerConfig.Mode == "" || providerConfig.Mode == "password" {
providerConfig.PrivateKey = ""
}
authMethods, err := buildAuthMethods(providerConfig.Password, providerConfig.PrivateKey) authMethods, err := buildAuthMethods(providerConfig.Password, providerConfig.PrivateKey)
if err != nil { if err != nil {

View File

@ -264,7 +264,10 @@ func RunNode(node *WorkflowNode, ctx *ExecutionContext) error {
lastStatus := ctx.GetStatus(node.Config["fromNodeId"].(string)) lastStatus := ctx.GetStatus(node.Config["fromNodeId"].(string))
for _, branch := range node.ConditionNodes { for _, branch := range node.ConditionNodes {
if branch.Config["type"] == string(lastStatus) { if branch.Config["type"] == string(lastStatus) {
return RunNode(branch, ctx) err := RunNode(branch, ctx)
if err != nil {
return fmt.Errorf("执行条件分支失败: %v", err)
}
} }
} }
} }