浏览代码

ensure machineID is included early enough into the alert (#1004)

Thibault "bui" Koechlin 3 年之前
父节点
当前提交
2961a0ed02
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      pkg/apiserver/controllers/v1/alerts.go

+ 1 - 3
pkg/apiserver/controllers/v1/alerts.go

@@ -127,6 +127,7 @@ func (c *Controller) CreateAlert(gctx *gin.Context) {
 	}
 
 	for _, alert := range input {
+		alert.MachineID = machineID
 		if len(alert.Decisions) != 0 {
 			for pIdx, profile := range c.Profiles {
 				_, matched, err := csprofiles.EvaluateProfile(profile, alert)
@@ -168,9 +169,6 @@ func (c *Controller) CreateAlert(gctx *gin.Context) {
 		c.HandleDBErrors(gctx, err)
 		return
 	}
-	for _, alert := range input {
-		alert.MachineID = machineID
-	}
 
 	if c.CAPIChan != nil {
 		select {