wwlog provides named loggers for each level, which requires less code and is clearer than wwlog.Printf. The code has included a mix of both, but this commit consolidates existing code on the per-level functions. Signed-off-by: Jonathon Anderson <janderson@ciq.co>
25 lines
512 B
Go
25 lines
512 B
Go
package syncuser
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/hpcng/warewulf/internal/pkg/container"
|
|
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func CobraRunE(cmd *cobra.Command, args []string) error {
|
|
containerName := args[0]
|
|
if !container.ValidName(containerName) {
|
|
return fmt.Errorf("%s is not a valid container", containerName)
|
|
}
|
|
err := container.SyncUids(containerName, !write)
|
|
if err != nil {
|
|
wwlog.Error("Error in synchronize: %s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
return nil
|
|
}
|