UI Updates with a few minor fixups scattered here and there

This commit is contained in:
Gregory Kurtzer
2021-01-14 20:23:42 -08:00
parent 72a40c2eca
commit 72b1d8c9d8
67 changed files with 358 additions and 478 deletions

View File

@@ -1,13 +1,14 @@
package hosts
import (
"bytes"
"fmt"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
"bytes"
"text/template"
)
@@ -15,12 +16,17 @@ type TemplateStruct struct {
PrevHostFile string
Ipaddr string
Fqdn string
AllNodes []node.NodeInfo
AllNodes []node.NodeInfo
}
func CobraRunE(cmd *cobra.Command, args []string) error {
var replace TemplateStruct
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
if util.IsFile("/etc/warewulf/hosts.tmpl") == false {
wwlog.Printf(wwlog.WARN, "Template not found, not updating host file\n")
return nil
@@ -50,7 +56,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.WARN, "%s\n", err)
} else {
// if /etc/hosts.ww does not exist, backup /etc/hosts to /etc/hosts.wwbackup
if ! util.IsFile("/etc/hosts.wwbackup") {
if !util.IsFile("/etc/hosts.wwbackup") {
err = util.CopyFile("/etc/hosts", "/etc/hosts.wwbackup")
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)