Make the overlay auto-update configurable
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
ipaddr: 192.168.1.1
|
||||
ipaddr: 192.168.200.1
|
||||
netmask: 255.255.255.0
|
||||
warewulf:
|
||||
port: 9873
|
||||
secure: true
|
||||
autobuild overlays: true
|
||||
update interval: 60
|
||||
dhcp:
|
||||
enabled: true
|
||||
range start: 192.168.1.150
|
||||
range end: 192.168.1.200
|
||||
range start: 192.168.200.50
|
||||
range end: 192.168.200.99
|
||||
template: default
|
||||
systemd name: dhcpd
|
||||
tftp:
|
||||
|
||||
@@ -23,6 +23,7 @@ type WarewulfConf struct {
|
||||
Port int `yaml:"port"`
|
||||
Secure bool `yaml:"secure"`
|
||||
UpdateInterval int `yaml:"update interval"`
|
||||
AutobuildOverlays bool `yaml:"autobuild overlays"`
|
||||
}
|
||||
|
||||
type DhcpConf struct {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func (self *ControllerConf) Persist() error {
|
||||
func (controller *ControllerConf) Persist() error {
|
||||
|
||||
out, err := yaml.Marshal(self)
|
||||
out, err := yaml.Marshal(controller)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -66,10 +66,12 @@ func RuntimeOverlaySend(w http.ResponseWriter, req *http.Request) {
|
||||
if n.RuntimeOverlay.Defined() {
|
||||
fileName := config.RuntimeOverlayImage(n.Id.Get())
|
||||
|
||||
if conf.Warewulf.AutobuildOverlays == true {
|
||||
if !util.IsFile(fileName) || util.PathIsNewer(fileName, node.ConfigFile) || util.PathIsNewer(fileName, config.RuntimeOverlaySource(n.RuntimeOverlay.Get())) {
|
||||
daemonLogf("BUILD: %15s: Runtime Overlay\n", n.Id.Get())
|
||||
_ = overlay.BuildRuntimeOverlay([]node.NodeInfo{n})
|
||||
}
|
||||
}
|
||||
|
||||
err := sendFile(w, fileName, n.Id.Get())
|
||||
if err != nil {
|
||||
|
||||
@@ -7,9 +7,17 @@ import (
|
||||
"github.com/hpcng/warewulf/internal/pkg/node"
|
||||
"github.com/hpcng/warewulf/internal/pkg/overlay"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||
)
|
||||
|
||||
func SystemOverlaySend(w http.ResponseWriter, req *http.Request) {
|
||||
conf, err := warewulfconf.New()
|
||||
if err != nil {
|
||||
daemonLogf("ERROR: Could not read Warewulf configuration file: %s\n", err)
|
||||
w.WriteHeader(503)
|
||||
return
|
||||
}
|
||||
|
||||
n, err := getSanity(req)
|
||||
if err != nil {
|
||||
w.WriteHeader(404)
|
||||
@@ -20,10 +28,12 @@ func SystemOverlaySend(w http.ResponseWriter, req *http.Request) {
|
||||
if n.SystemOverlay.Defined() {
|
||||
fileName := config.SystemOverlayImage(n.Id.Get())
|
||||
|
||||
if conf.Warewulf.AutobuildOverlays == true {
|
||||
if !util.IsFile(fileName) || util.PathIsNewer(fileName, node.ConfigFile) || util.PathIsNewer(fileName, config.SystemOverlaySource(n.SystemOverlay.Get())) {
|
||||
daemonLogf("BUILD: %15s: System Overlay\n", n.Id.Get())
|
||||
_ = overlay.BuildSystemOverlay([]node.NodeInfo{n})
|
||||
}
|
||||
}
|
||||
|
||||
err := sendFile(w, fileName, n.Id.Get())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user