fix(drivers): rainyun run away
This commit is contained in:
@@ -3,6 +3,7 @@ package rainyun
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ssdomei232/goodBaby/internal/retry"
|
||||
"github.com/ssdomei232/goodBaby/model"
|
||||
@@ -117,5 +118,9 @@ func RainyunRunAway(ctx context.Context, rule *model.Rule) error {
|
||||
}
|
||||
}
|
||||
|
||||
if len(fails) > 0 {
|
||||
return fmt.Errorf("%d/%d 台云服务器重装失败: %s", len(fails), total, strings.Join(fails, "; "))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -19,3 +19,15 @@ func (e *RainyunWorkorderExecutor) Execute(ctx context.Context, rule *model.Rule
|
||||
|
||||
return SendRainyunWorkorderMsg(ctx, rule)
|
||||
}
|
||||
|
||||
// RainyunRunAwayExecutor 雨云跑路执行器
|
||||
type RainyunRunAwayExecutor struct{}
|
||||
|
||||
func (e *RainyunRunAwayExecutor) GetType() string {
|
||||
return "rainyun-runaway"
|
||||
}
|
||||
|
||||
func (e *RainyunRunAwayExecutor) Execute(ctx context.Context, rule *model.Rule) error {
|
||||
log.Printf("执行雨云跑路规则: %s", rule.Name)
|
||||
return RainyunRunAway(ctx, rule)
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ func InitExecutorRegistry() *ExecutorRegistry {
|
||||
registry.Register(&dingtalk.DingTalkExecutor{})
|
||||
registry.Register(&fwalert.FwalertExecutor{})
|
||||
registry.Register(&rainyun.RainyunWorkorderExecutor{})
|
||||
registry.Register(&rainyun.RainyunRunAwayExecutor{})
|
||||
// 未来添加新规则类型时,在这里注册即可
|
||||
|
||||
globalExecutorRegistry = registry
|
||||
|
||||
Reference in New Issue
Block a user