local-server/ipxe.go
2018-06-12 21:09:47 +11:00

26 lines
424 B
Go

package main
import (
"bytes"
"io"
"log"
"text/template"
)
func renderIPXE(out io.Writer, ctx *renderContext) error {
log.Printf("sending IPXE code for %q", ctx.Host.Name)
tmpl, err := template.New("ipxe").Parse(ctx.Group.IPXE)
if err != nil {
return err
}
buf := bytes.NewBuffer(make([]byte, 0, 4096))
if err := tmpl.Execute(buf, ctx); err != nil {
return err
}
_, err = buf.WriteTo(out)
return err
}