From 8197484461ae87b1e1562885ad5a3708a0362348 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Tue, 11 Feb 2025 09:44:19 -0700 Subject: [PATCH] Make wwctl image syncuser --write true by default It can be disabled with `wwctl image syncuser --write=false`. Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 1 + internal/app/wwctl/image/syncuser/main.go | 2 +- internal/app/wwctl/image/syncuser/root.go | 2 +- internal/pkg/image/syncuser.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4488db11..d21e08e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Updated overlay flags to `wwctl [--runtime-overlays|--system-overlays]`. #1495 - syncuser overlay reads host passwd and group database from sysconfdir. #1736 - syncuser overlay skips duplicate users and groups in passwd and group databases. #829 +- `wwctl image syncuser --write` is true by default. ### Fixed diff --git a/internal/app/wwctl/image/syncuser/main.go b/internal/app/wwctl/image/syncuser/main.go index 7b8f52e0..8be540b6 100644 --- a/internal/app/wwctl/image/syncuser/main.go +++ b/internal/app/wwctl/image/syncuser/main.go @@ -22,7 +22,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if write && !build { // when write = true and build = false, we will print a warnning, this is the default case - wwlog.Warn("Syncuser is completed, please remember to rebuild image or add `--build` flag for automatic rebuild after syncuser") + wwlog.Warn("Syncuser is completed. Rebuild image or add `--build` flag for automatic rebuild after syncuser.") } else if write && build { // if write = true and build = true, then it'll trigger the image build after sync cbp := &wwapiv1.ImageBuildParameter{ diff --git a/internal/app/wwctl/image/syncuser/root.go b/internal/app/wwctl/image/syncuser/root.go index ebd103d4..1efae9b0 100644 --- a/internal/app/wwctl/image/syncuser/root.go +++ b/internal/app/wwctl/image/syncuser/root.go @@ -29,7 +29,7 @@ uid/gid collision is detected. File ownerships are also changed.`, ) func init() { - baseCmd.PersistentFlags().BoolVar(&write, "write", false, "Synchronize uis/gids and write files in image") + baseCmd.PersistentFlags().BoolVar(&write, "write", true, "Synchronize uis/gids and write files in image") baseCmd.PersistentFlags().BoolVar(&build, "build", false, "Build image after syncuser is completed") } diff --git a/internal/pkg/image/syncuser.go b/internal/pkg/image/syncuser.go index 67ad6e1d..372a30a1 100644 --- a/internal/pkg/image/syncuser.go +++ b/internal/pkg/image/syncuser.go @@ -86,7 +86,7 @@ func Syncuser(imageName string, write bool) error { wwlog.Info("uid/gid synced for image %s", imageName) } else { if passwdSync.needsSync() || groupSync.needsSync() { - wwlog.Info("uid/gid not synced: run `wwctl image syncuser --write %s`", imageName) + wwlog.Info("uid/gid not synced: run `wwctl image syncuser --write=true %s` to synchronize", imageName) } else { wwlog.Info("uid/gid already synced") }