From be41b7926145c8c6a59a6326a50afc6ba1cf5c66 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sat, 15 Jan 2022 02:27:45 +0000 Subject: [PATCH] Don't use init function to load status DB --- internal/pkg/warewulfd/status.go | 5 ----- internal/pkg/warewulfd/warewulfd.go | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/pkg/warewulfd/status.go b/internal/pkg/warewulfd/status.go index 3a1191b3..eb4d462d 100644 --- a/internal/pkg/warewulfd/status.go +++ b/internal/pkg/warewulfd/status.go @@ -26,11 +26,6 @@ var statusDB allStatus func init() { statusDB.Nodes = make(map[string]*NodeStatus) - - err := LoadNodeStatus() - if err != nil { - wwlog.Printf(wwlog.ERROR, "Could not prepopulate status DB with nodes: %s\n", err) - } } func LoadNodeStatus() error { diff --git a/internal/pkg/warewulfd/warewulfd.go b/internal/pkg/warewulfd/warewulfd.go index 2c5f4044..1600a637 100644 --- a/internal/pkg/warewulfd/warewulfd.go +++ b/internal/pkg/warewulfd/warewulfd.go @@ -41,6 +41,11 @@ func RunServer() error { fmt.Printf("ERROR: Could not load database: %s\n", err) } + err = LoadNodeStatus() + if err != nil { + wwlog.Printf(wwlog.ERROR, "Could not prepopulate node status DB: %s\n", err) + } + http.HandleFunc("/ipxe/", IpxeSend) http.HandleFunc("/kernel/", KernelSend) http.HandleFunc("/kmods/", KmodsSend)