From 60b586b69a55d1008478fa974c2962c249b034c6 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Tue, 3 May 2022 21:52:13 -0700 Subject: [PATCH] Don't do SyncUids by default always --- internal/app/wwctl/container/exec/main.go | 6 +++--- internal/app/wwctl/container/exec/root.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/app/wwctl/container/exec/main.go b/internal/app/wwctl/container/exec/main.go index 4d405e91..eccab4ff 100644 --- a/internal/app/wwctl/container/exec/main.go +++ b/internal/app/wwctl/container/exec/main.go @@ -78,7 +78,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { unixStat = fileStat.Sys().(*syscall.Stat_t) syncuids := false if passwdTime.Before(time.Unix(int64(unixStat.Ctim.Sec), int64(unixStat.Ctim.Nsec))) { - if NoSyncUser { + if !SyncUser { wwlog.Printf(wwlog.WARN, "/etc/passwd has been modified, maybe you want to run syncuser\n") } syncuids = true @@ -87,13 +87,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fileStat, _ = os.Stat(path.Join(containerPath, "/etc/group")) unixStat = fileStat.Sys().(*syscall.Stat_t) if groupTime.Before(time.Unix(int64(unixStat.Ctim.Sec), int64(unixStat.Ctim.Nsec))) { - if NoSyncUser { + if !SyncUser { wwlog.Printf(wwlog.WARN, "/etc/group has been modified, maybe you want to run syncuser\n") } syncuids = true } wwlog.Printf(wwlog.DEBUG, "group: %v\n", time.Unix(int64(unixStat.Ctim.Sec), int64(unixStat.Ctim.Nsec))) - if syncuids && !NoSyncUser { + if syncuids && SyncUser { err = container.SyncUids(containerName, true) if err != nil { wwlog.Printf(wwlog.ERROR, "Error in user sync, fix error and run 'syncuser' manually, but trying to build container: %s\n", err) diff --git a/internal/app/wwctl/container/exec/root.go b/internal/app/wwctl/container/exec/root.go index 5294b591..db8bea41 100644 --- a/internal/app/wwctl/container/exec/root.go +++ b/internal/app/wwctl/container/exec/root.go @@ -25,14 +25,14 @@ var ( }, FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, } - NoSyncUser bool - binds []string + SyncUser bool + binds []string ) func init() { baseCmd.AddCommand(child.GetCommand()) baseCmd.PersistentFlags().StringArrayVarP(&binds, "bind", "b", []string{}, "Bind a local path into the container (must exist)") - baseCmd.PersistentFlags().BoolVar(&NoSyncUser, "nosyncuser", false, "Don't synchronize uis/gods from host to container") + baseCmd.PersistentFlags().BoolVar(&SyncUser, "syncuser", false, "Synchronize UIDs/GIDs from host to container") } // GetRootCommand returns the root cobra.Command for the application.