return fmt.Errorf("%s: invalid %v", path, err)
}
err = tmpl.Execute(&buf, &templateArgs{
- host: host,
+ Host: host,
+ Hostname: strings.Split(host, ".")[0],
groups: groupsMap,
allHosts: allHostsMap,
allGroups: allGroupsMap,
// templateArgs is passed to .Execute() of the template.
type templateArgs struct {
- host string
+ Host string
+ Hostname string
groups map[string]bool
allHosts map[string]bool
allGroups map[string]bool
if !t.allHosts[host] {
panic(fmt.Sprintf("host %q does not exist", host))
}
- return t.host == host
+ return t.Host == host
}
func (t *templateArgs) InGroup(group string) bool {
// Don't permit invalid groups to detect typos; detected groups cannot be