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
25 lines
526 B
Go
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
|
|
}
|