fix(go.d/dyncfg): fix duplicate potential "name" in userconfig action (#20346)
Ilya Mashchenko committed
May 26, 2025 at 14:55 UTC
66559f80bc06a7ae135b478878be1aef6616cee0
1 file changed
+5
src/go/plugin/go.d/agent/jobmgr/dyncfg_collector.go
+5
@@ -8,6 +8,7 @@ import (
8
"errors"
9
"fmt"
10
"log/slog"
11
+ "slices"
12
"strconv"
13
"strings"
14
"time"
@@ -737,6 +738,10 @@ func userConfigFromPayload(cfg any, jobName string, fn functions.Function) ([]by
738
return nil, err
739
}
740
741
+ yms = slices.DeleteFunc(yms, func(item yaml.MapItem) bool {
742
+ return item.Key == "name"
743
+ })
744
+
745
yms = append([]yaml.MapItem{{Key: "name", Value: jobName}}, yms...)
746
747
v := map[string]any{