syncucer will only write witrh syncuser switch

uid/gid are not synced at container import but checked. An apropriate
message is printed, regarding users which are not present on host.
The `wwctl container syncuser` needs the `--write` switch to actually
write to the container.

The command `wwctl container syncuser` will always operate at the
container level, but as the 'generic` overlay reads in the container
passwd/group, following two steps will update the passwd/group on a
running cluster:
1. Add passwd/group to container
wwctl container syncuser --write CONTAINER
2. Synchronize overlay
wwctl overlay build -N
This commit is contained in:
Christian Goll
2022-05-12 10:01:03 +02:00
parent fea148903c
commit 2efcbe0348
5 changed files with 9 additions and 8 deletions

View File

@@ -130,8 +130,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.WARN, "Could not copy /etc/resolv.conf into container: %s\n", err)
}
err = container.SyncUids(name, !NoSyncUser)
if err != nil && !NoSyncUser {
err = container.SyncUids(name, !SyncUser)
if err != nil && !SyncUser {
wwlog.Printf(wwlog.ERROR, "Error in user sync, fix error and run 'syncuser' manually: %s\n", err)
os.Exit(1)
}

View File

@@ -24,7 +24,7 @@ Imported containers are used to create bootable VNFS images.`,
SetUpdate bool
SetBuild bool
SetDefault bool
NoSyncUser bool
SyncUser bool
)
func init() {
@@ -32,7 +32,7 @@ func init() {
baseCmd.PersistentFlags().BoolVarP(&SetUpdate, "update", "u", false, "Update and overwrite an existing container")
baseCmd.PersistentFlags().BoolVarP(&SetBuild, "build", "b", false, "Build container when after pulling")
baseCmd.PersistentFlags().BoolVar(&SetDefault, "setdefault", false, "Set this container for the default profile")
baseCmd.PersistentFlags().BoolVar(&NoSyncUser, "nosyncuser", false, "Don't synchronize uis/gods from host to container")
baseCmd.PersistentFlags().BoolVar(&SyncUser, "syncuser", false, "Synchronize uis/gods from host to container")
}
// GetRootCommand returns the root cobra.Command for the application.