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) {
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",
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
+ const maxRecursionDepth = 100
detectedGroupsMap := make(map[string]bool)
for _, x := range detectedGroups {
// groups).
var lookup func(string, int) bool
lookup = func(group string, depth int) bool {
- if depth > maxDepth {
+ if depth > maxRecursionDepth {
cycle = &group
return false
}