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

@@ -25,12 +25,12 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
overlayPath = overlay.OverlaySourceDir(overlayName)
if overlayPath == "" {
wwlog.Error("Overlay name did not resolve: '%s'\n", overlayName)
wwlog.Error("Overlay name did not resolve: '%s'", overlayName)
os.Exit(1)
}
if !util.IsDir(overlayPath) {
wwlog.Error("Overlay does not exist: %s\n", overlayName)
wwlog.Error("Overlay does not exist: %s", overlayName)
os.Exit(1)
}
@@ -55,22 +55,22 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
removePath := path.Join(overlayPath, fileName)
if !util.IsDir(removePath) && !util.IsFile(removePath) {
wwlog.Error("Path to remove doesn't exist in overlay: %s\n", removePath)
wwlog.Error("Path to remove doesn't exist in overlay: %s", removePath)
os.Exit(1)
}
if Force {
err := os.RemoveAll(removePath)
if err != nil {
wwlog.Error("Failed deleting file from overlay: %s:%s\n", overlayName, overlayPath)
wwlog.Error("%s\n", err)
wwlog.Error("Failed deleting file from overlay: %s:%s", overlayName, overlayPath)
wwlog.Error("%s", err)
os.Exit(1)
}
} else {
err := os.Remove(removePath)
if err != nil {
wwlog.Error("Failed deleting overlay: %s:%s\n", overlayName, overlayPath)
wwlog.Error("%s\n", err)
wwlog.Error("Failed deleting overlay: %s:%s", overlayName, overlayPath)
wwlog.Error("%s", err)
os.Exit(1)
}
}
@@ -79,13 +79,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
// Cleanup any empty directories left behind...
i := path.Dir(removePath)
for i != overlayPath {
wwlog.Debug("Evaluating directory to remove: %s\n", i)
wwlog.Debug("Evaluating directory to remove: %s", i)
err := os.Remove(i)
if err != nil {
break
}
wwlog.Verbose("Removed empty directory: %s\n", i)
wwlog.Verbose("Removed empty directory: %s", i)
i = path.Dir(i)
}
}