Updates to build an RPM

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
This commit is contained in:
jcsiadal
2021-11-01 11:32:59 -07:00
parent de2c882ba1
commit f7396ae5be
4 changed files with 81 additions and 52 deletions

View File

@@ -1,9 +1,6 @@
package node
import (
"fmt"
"os"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
@@ -104,22 +101,10 @@ type NetDevEntry struct {
}
func init() {
//TODO: Check to make sure nodes.conf is found
// Check that nodes.conf is found
if !util.IsFile(ConfigFile) {
c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0640)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err)
// just return silently, as init is also called for bash_completion
return
}
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, "nodes: {}\n")
c.Close()
wwlog.Printf(wwlog.INFO, "Created default node configuration\n")
wwlog.Printf(wwlog.WARN, "Missing node configuration file\n")
// just return silently, as init is also called for bash_completion
return
}
}