From df96dee6beaf8cbacfb15523c065c9a72a6b60ea Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Thu, 3 Dec 2020 19:14:40 -0800 Subject: [PATCH] Added a configurable update interval for WWClient --- cmd/wwclient/wwclient.go | 6 +++++- etc/warewulf.conf | 1 + internal/pkg/warewulfconf/datastructure.go | 9 +++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/wwclient/wwclient.go b/cmd/wwclient/wwclient.go index fd79ef46..bbf25217 100644 --- a/cmd/wwclient/wwclient.go +++ b/cmd/wwclient/wwclient.go @@ -91,6 +91,10 @@ func main() { log.Printf("ERROR: Failed running CPIO: %s\n", err) } - time.Sleep(30000 * time.Millisecond) + if conf.Warewulf.UpdateInterval > 0 { + time.Sleep(time.Duration(conf.Warewulf.UpdateInterval*1000) * time.Millisecond) + } else { + time.Sleep(30000 * time.Millisecond * 1000) + } } } diff --git a/etc/warewulf.conf b/etc/warewulf.conf index 1f10ceec..7478d07b 100644 --- a/etc/warewulf.conf +++ b/etc/warewulf.conf @@ -3,6 +3,7 @@ netmask: 255.255.255.0 warewulf: port: 9873 secure: true + update interval: 60 dhcp: enabled: true range start: 192.168.1.150 diff --git a/internal/pkg/warewulfconf/datastructure.go b/internal/pkg/warewulfconf/datastructure.go index ca5c2cda..ca88ac99 100644 --- a/internal/pkg/warewulfconf/datastructure.go +++ b/internal/pkg/warewulfconf/datastructure.go @@ -20,10 +20,11 @@ type ControllerConf struct { } type WarewulfConf struct { - Port int `yaml:"port,omitempty"` - Secure bool `yaml:"secure,omitempty"` - Enable string `yaml:"enable command,omitempty"` - Restart string `yaml:"restart command,omitempty"` + Port int `yaml:"port,omitempty"` + Secure bool `yaml:"secure,omitempty"` + Enable string `yaml:"enable command,omitempty"` + Restart string `yaml:"restart command,omitempty"` + UpdateInterval int `yaml:"update interval,omitempty"` } type DhcpConf struct {