Make wwctl image syncuser --write true by default

It can be disabled with `wwctl image syncuser --write=false`.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-11 09:44:19 -07:00
parent 01b3c28874
commit 8197484461
4 changed files with 4 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Updated overlay flags to `wwctl <node|profile> <add|set> [--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

View File

@@ -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{

View File

@@ -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")
}

View File

@@ -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")
}