mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #13406 from ioito/hotfix/qx-waf-rule-sync
fix(region): skip first sync waf rule
This commit is contained in:
@@ -207,7 +207,7 @@ func (self *SSkuResourcesMeta) newFromCloudWafGroup(ctx context.Context, userCre
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SSkuResourcesMeta) SyncWafGroups(ctx context.Context, userCred mcclient.TokenCredential, cloudEnv string) compare.SyncResult {
|
||||
func (self *SSkuResourcesMeta) SyncWafGroups(ctx context.Context, userCred mcclient.TokenCredential, cloudEnv string, isStart bool) compare.SyncResult {
|
||||
lockman.LockRawObject(ctx, cloudEnv, "waf-rule-group")
|
||||
defer lockman.ReleaseRawObject(ctx, cloudEnv, "waf-rule-group")
|
||||
|
||||
@@ -223,6 +223,11 @@ func (self *SSkuResourcesMeta) SyncWafGroups(ctx context.Context, userCred mccli
|
||||
return result
|
||||
}
|
||||
|
||||
if isStart && len(dbGroup) > 0 {
|
||||
log.Infof("%s waf group already synced, skip...", cloudEnv)
|
||||
return result
|
||||
}
|
||||
|
||||
removed := make([]SWafRuleGroup, 0)
|
||||
commondb := make([]SWafRuleGroup, 0)
|
||||
commonext := make([]sWafGroup, 0)
|
||||
@@ -293,7 +298,7 @@ func SyncWafGroups(ctx context.Context, userCred mcclient.TokenCredential, isSta
|
||||
log.Infof("%s Waf group not Changed skip syncing", cloudEnv)
|
||||
continue
|
||||
}
|
||||
result := meta.SyncWafGroups(ctx, userCred, cloudEnv)
|
||||
result := meta.SyncWafGroups(ctx, userCred, cloudEnv, isStart)
|
||||
log.Infof("sync %s waf group result: %s", cloudEnv, result.Result())
|
||||
wafIndex[cloudEnv] = newMd5
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ type SWafRule struct {
|
||||
// 规则优先级
|
||||
Priority int `nullable:"false" list:"domain" create:"required"`
|
||||
// 规则默认行为
|
||||
Action *cloudprovider.DefaultAction `charset:"utf8" nullable:"false" list:"user" update:"domain" create:"required"`
|
||||
Action *cloudprovider.DefaultAction `charset:"utf8" nullable:"true" list:"user" update:"domain" create:"required"`
|
||||
// 条件
|
||||
StatementConditon cloudprovider.TWafStatementCondition `width:"20" charset:"ascii" nullable:"false" list:"domain" create:"optional"`
|
||||
// 规则组的id
|
||||
|
||||
Reference in New Issue
Block a user