Don't do SyncUids by default always

This commit is contained in:
Gregory Kurtzer
2022-05-03 21:52:13 -07:00
parent c95c518dde
commit 60b586b69a
2 changed files with 6 additions and 6 deletions

View File

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