Extend and optimize relocatable build config infrastructure

This commit is contained in:
Gregory Kurtzer
2022-01-15 03:32:32 +00:00
parent be41b79261
commit 8da7dd415a
23 changed files with 258 additions and 348 deletions

View File

@@ -8,6 +8,7 @@ import (
"strings"
"text/template"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
@@ -84,12 +85,12 @@ func Configure(show bool) error {
d.Nodes = append(d.Nodes, nodes...)
if controller.Dhcp.Template == "" {
templateFile = "/etc/warewulf/dhcp/default-dhcpd.conf"
templateFile = path.Join(buildconfig.SYSCONFDIR, "warewulf/dhcp/default-dhcpd.conf")
} else {
if strings.HasPrefix(controller.Dhcp.Template, "/") {
templateFile = controller.Dhcp.Template
} else {
templateFile = fmt.Sprintf("/etc/warewulf/dhcp/%s-dhcpd.conf", controller.Dhcp.Template)
templateFile = path.Join(buildconfig.SYSCONFDIR, "warewulf/dhcp/"+controller.Dhcp.Template+"dhcpd.conf")
}
}