X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fconfig%2Fgroups.go;h=571f19b7fcb10b5adcd4c5e406d6f22e5b585730;hb=e452996e2008d438aa68dedbd206525f507b73d3;hp=5f3f679f5a9bde9ec1368d3f705f08d313647094;hpb=45f6c93c3d7ef4a300707bb96d4a1e1fce6df55f;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/config/groups.go b/cmd/safcm/config/groups.go index 5f3f679..571f19b 100644 --- a/cmd/safcm/config/groups.go +++ b/cmd/safcm/config/groups.go @@ -34,7 +34,7 @@ const ( GroupRemoveSuffix = GroupSpecialSeparator + "remove" ) -// Keep in sync with sync_info.go:infoGroupDetectedRegexp +// Keep in sync with cmd/safcm/sync_info.go:infoGroupDetectedRegexp var groupNameRegexp = regexp.MustCompile(`^[a-z0-9_-]+$`) func LoadGroups(cfg *Config, hosts *Hosts) (map[string][]string, error) { @@ -86,6 +86,8 @@ func LoadGroups(cfg *Config, hosts *Hosts) (map[string][]string, error) { if x == GroupAll { continue } + // Don't validate against groupNameRegexp because + // hosts have less strict restrictions. if strings.Contains(x, GroupSpecialSeparator) { return nil, fmt.Errorf( "%s member %q must not contain %q", @@ -126,8 +128,7 @@ func LoadGroups(cfg *Config, hosts *Hosts) (map[string][]string, error) { return groups, nil } -func ResolveHostGroups(host string, - groups map[string][]string, +func ResolveHostGroups(host string, groups map[string][]string, detectedGroups []string) ([]string, error) { const maxDepth = 100