Don't use init function to load status DB

This commit is contained in:
Gregory Kurtzer
2022-01-15 02:27:45 +00:00
parent 3f68bc86db
commit be41b79261
2 changed files with 5 additions and 5 deletions

View File

@@ -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 {

View File

@@ -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)