basic function comparing uids of host/container

This commit is contained in:
Christian Goll
2022-02-28 15:17:33 +01:00
committed by Christian Goll
parent 95050a44ce
commit 8c7fd7d140
7 changed files with 330 additions and 9 deletions

View File

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

View File

@@ -5,20 +5,20 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "import [OPTIONS] SOURCE [NAME]",
Short: "Import a container into Warewulf",
Long:
`This command will pull and import a container into Warewulf from SOURCE,
Use: "import [OPTIONS] SOURCE [NAME]",
Short: "Import a container into Warewulf",
Long: `This command will pull and import a container into Warewulf from SOURCE,
optionally renaming it to NAME. The SOURCE must be in a supported URI format.
Imported containers are used to create bootable VNFS images.`,
Example: "wwctl container import docker://warewulf/centos-8 my_container",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
SetForce bool
SetUpdate bool
SetBuild bool
SetDefault bool
NoSyncUser bool
)
func init() {
@@ -26,6 +26,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")
}
// GetRootCommand returns the root cobra.Command for the application.