Files
warewulf/internal/app/wwctl/container/syncuser/main.go
Christian Goll 2efcbe0348 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
2022-05-12 11:18:53 +02:00

25 lines
526 B
Go

package syncuser
import (
"fmt"
"os"
"github.com/hpcng/warewulf/internal/pkg/container"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
containerName := args[0]
if !container.ValidName(containerName) {
return fmt.Errorf("%s is not a valid container", containerName)
}
err := container.SyncUids(containerName, !write)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Error in synchronize: %s\n", err)
os.Exit(1)
}
return nil
}