From 2961a0ed029837e75ed95d1119785be8e866bb39 Mon Sep 17 00:00:00 2001 From: "Thibault \"bui\" Koechlin" Date: Mon, 11 Oct 2021 15:02:16 +0200 Subject: [PATCH] ensure machineID is included early enough into the alert (#1004) --- pkg/apiserver/controllers/v1/alerts.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/apiserver/controllers/v1/alerts.go b/pkg/apiserver/controllers/v1/alerts.go index 65b00fcfd..963b61712 100644 --- a/pkg/apiserver/controllers/v1/alerts.go +++ b/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 {