X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_info.go;h=fd480063629a67e5f1c1c8d103ee1b19107fae88;hb=116e5ebec76bbdf4f70ef4b5fc3ebb55cafee719;hp=0df33e3eeaa302ef52c8a7d149e5f107d82812b1;hpb=5d6cc7f14a4bacc36bf3a23cd735a75ad4a90f1d;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_info.go b/cmd/safcm/sync_info.go index 0df33e3..fd48006 100644 --- a/cmd/safcm/sync_info.go +++ b/cmd/safcm/sync_info.go @@ -50,14 +50,19 @@ var infoGroupDetectedRegexp = regexp.MustCompile(`[^a-z0-9_-]+`) func hostInfoRespToGroups(resp safcm.MsgInfoResp) []string { groups := []string{ - config.GroupDetectedPrefix + "_" + resp.Goos, - config.GroupDetectedPrefix + "_" + resp.Goarch, + hostInfoDetectedGroupName(resp.Goos), + hostInfoDetectedGroupName(resp.Goarch), } for _, x := range resp.Output { - x = strings.TrimSpace(x) - x = strings.ToLower(x) - x = infoGroupDetectedRegexp.ReplaceAllString(x, "_") - groups = append(groups, config.GroupDetectedPrefix+"_"+x) + groups = append(groups, hostInfoDetectedGroupName(x)) } return groups } + +func hostInfoDetectedGroupName(x string) string { + x = strings.TrimSpace(x) + x = strings.ToLower(x) + x = infoGroupDetectedRegexp.ReplaceAllString(x, "_") + x = config.GroupDetectedPrefix + "_" + x + return x +}