Skip to content

Commit

Permalink
fix: config items not being assigned parents
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Sep 12, 2024
1 parent 57d9b7b commit fd759b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ func getPath(ctx api.ScrapeContext, parentMap map[string]string, self string) (s

for parent := getOrFind(ctx, parentMap, self); parent != ""; parent = getOrFind(ctx, parentMap, parent) {
if slices.Contains(paths, parent) {
return "", false
return strings.Join(paths, "."), true
}
paths = append([]string{parent}, paths...)
}
Expand Down Expand Up @@ -1144,7 +1144,7 @@ func setConfigPaths(ctx api.ScrapeContext, allConfigs []*models.ConfigItem) erro
}

for _, config := range allConfigs {
for i := 1; i < len(config.ProbableParents); i++ {
for i := 0; i < len(config.ProbableParents); i++ {
// If no cylce is detected, we set path and parentID
path, ok := getPath(ctx, parentMap, config.ID)
if ok {
Expand Down

0 comments on commit fd759b6

Please sign in to comment.