Don't use init function to load status DB
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user