This commit is contained in:
Mikaël Cluseau
2018-12-10 21:59:24 +11:00
parent 63f991bbd2
commit 26b6efd54c
13 changed files with 788 additions and 340 deletions

View File

@ -1,25 +1,13 @@
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.asMap()); err != nil {
return err
}
_, err = buf.WriteTo(out)
_, err := out.Write([]byte(ctx.Host.IPXE))
return err
}