Remove trailing newline from wwlog

I noticed that some wwlog calls included a trailing newline, but others
did not. I tested both in isolation and discovered that the behavior was
consistent regardless of whether a trailing newline was included. I
further confirmed in code that wwlog appends a trailing newline
automatically if it is not present; so a trailing newline is unnecessary
in individual calls.

This commit removes trailing newlines from all calls to make them
consistent. It also replaces two calls to wwlog.Printf. (see #534)

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
This commit is contained in:
Jonathon Anderson
2022-09-15 12:38:03 -06:00
parent fc39209fbb
commit 0b3e862bea
58 changed files with 327 additions and 327 deletions

View File

@@ -16,13 +16,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
nodeDB, err := node.New()
if err != nil {
wwlog.Error("Could not open node configuration: %s\n", err)
wwlog.Error("Could not open node configuration: %s", err)
os.Exit(1)
}
nodes, err := nodeDB.FindAllNodes()
if err != nil {
wwlog.Error("Could not get node list: %s\n", err)
wwlog.Error("Could not get node list: %s", err)
os.Exit(1)
}
@@ -44,7 +44,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
for _, node := range nodes {
if node.Ipmi.Ipaddr.Get() == "" {
wwlog.Error("%s: No IPMI IP address\n", node.Id.Get())
wwlog.Error("%s: No IPMI IP address", node.Id.Get())
continue
}
@@ -61,7 +61,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
err := ipmiCmd.Console()
if err != nil {
wwlog.Error("%s: Console problem\n", node.Id.Get())
wwlog.Error("%s: Console problem", node.Id.Get())
returnErr = err
continue
}

View File

@@ -17,13 +17,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
nodeDB, err := node.New()
if err != nil {
wwlog.Error("Could not open node configuration: %s\n", err)
wwlog.Error("Could not open node configuration: %s", err)
os.Exit(1)
}
nodes, err := nodeDB.FindAllNodes()
if err != nil {
wwlog.Error("Could not get node list: %s\n", err)
wwlog.Error("Could not get node list: %s", err)
os.Exit(1)
}
@@ -48,7 +48,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
for _, node := range nodes {
if node.Ipmi.Ipaddr.Get() == "" {
wwlog.Error("%s: No IPMI IP address\n", node.Id.Get())
wwlog.Error("%s: No IPMI IP address", node.Id.Get())
continue
}
var ipmiInterface = "lan"
@@ -92,7 +92,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
out, err := result.Result()
if err != nil {
wwlog.Error("%s: %s\n", result.NodeName, out)
wwlog.Error("%s: %s", result.NodeName, out)
returnErr = err
continue
}

View File

@@ -21,12 +21,12 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
controller, err := warewulfconf.New()
if err != nil {
wwlog.Error("%s\n", err)
wwlog.Error("%s", err)
os.Exit(1)
}
if controller.Ipaddr == "" {
wwlog.Error("The Warewulf Server IP Address is not properly configured\n")
wwlog.Error("The Warewulf Server IP Address is not properly configured")
os.Exit(1)
}
@@ -46,7 +46,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
fmt.Print("\033[H\033[2J")
_, height, err = term.GetSize(0)
if err != nil {
wwlog.Warn("Could not get terminal height, using 24\n")
wwlog.Warn("Could not get terminal height, using 24")
height = 24
}
}
@@ -54,7 +54,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
fmt.Printf("%-20s %-20s %-25s %-10s\n", "NODENAME", "STAGE", "SENT", "LASTSEEN (s)")
fmt.Printf("%s\n", strings.Repeat("=", 80))
wwlog.Verbose("Building sort index\n")
wwlog.Verbose("Building sort index")
var statuses []*wwapiv1.NodeStatus
if len(args) > 0 {
nodeList := hostlist.Expand(args)
@@ -72,7 +72,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
}
}
wwlog.Verbose("Sorting index\n")
wwlog.Verbose("Sorting index")
if SetSortLast {
sort.Slice(statuses, func(i, j int) bool {
if statuses[i].Lastseen > statuses[j].Lastseen {
@@ -84,7 +84,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
}
})
} else if SetSortReverse {
wwlog.Verbose("Reversing sort order\n")
wwlog.Verbose("Reversing sort order")
sort.Slice(statuses, func(i, j int) bool {
return statuses[i].NodeName > statuses[j].NodeName
})
@@ -95,7 +95,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
})
}
wwlog.Verbose("Printing results\n")
wwlog.Verbose("Printing results")
for i := 0; i < len(statuses); i++ {
o := statuses[i]
if SetTime > 0 && o.Lastseen < SetTime {