Merge branch 'main' of github.com:ctrliq/warewulf into main
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"os"
|
||||
@@ -31,6 +32,7 @@ type NodeConf struct {
|
||||
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
|
||||
SystemOverlay string `yaml:"system overlay files,omitempty"`
|
||||
Init string `yaml:"init,omitempty"`
|
||||
Discoverable bool `yaml:"discoverable,omitempty"`
|
||||
Profiles []string `yaml:"profiles,omitempty"`
|
||||
NetDevs map[string]*NetDevs `yaml:"network devices,omitempty"`
|
||||
}
|
||||
@@ -73,6 +75,8 @@ type NodeInfo struct {
|
||||
IpmiPassword Entry
|
||||
RuntimeOverlay Entry
|
||||
SystemOverlay Entry
|
||||
Discoverable Entry
|
||||
Disabled Entry
|
||||
Init Entry //TODO: Finish adding this...
|
||||
Profiles []string
|
||||
GroupProfiles []string
|
||||
@@ -91,7 +95,20 @@ type NetDevEntry struct {
|
||||
func init() {
|
||||
//TODO: Check to make sure nodes.conf is found
|
||||
if util.IsFile(ConfigFile) == false {
|
||||
wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile)
|
||||
os.Exit(1)
|
||||
c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0644)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Fprintf(c, "nodeprofiles:\n")
|
||||
fmt.Fprintf(c, " default:\n")
|
||||
fmt.Fprintf(c, " comment: This profile is automatically included for each node\n")
|
||||
fmt.Fprintf(c, " kernel args: crashkernel=no quiet\n")
|
||||
fmt.Fprintf(c, "nodes: {}\n")
|
||||
|
||||
c.Close()
|
||||
|
||||
wwlog.Printf(wwlog.INFO, "Created default node configuration\n")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user