Just check syncuids on default

This commit is contained in:
Christian Goll
2022-03-04 10:26:11 +01:00
committed by Christian Goll
parent 5fb10130f3
commit 61eae386af
5 changed files with 15 additions and 10 deletions

View File

@@ -128,13 +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)
}
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)
}
fmt.Printf("Building container: %s\n", name)
err = container.Build(name, true)
if err != nil {

View File

@@ -18,7 +18,7 @@ Imported containers are used to create bootable VNFS images.`,
SetUpdate bool
SetBuild bool
SetDefault bool
NoSyncUser bool
SyncUser bool
)
func init() {
@@ -26,7 +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")
baseCmd.PersistentFlags().BoolVar(&SyncUser, "syncuser", false, "Don't synchronize uis/gods from host to container")
}
// GetRootCommand returns the root cobra.Command for the application.