diff --git a/internal/app/wwctl/profile/set/main.go b/internal/app/wwctl/profile/set/main.go index c80bed74..536911a1 100644 --- a/internal/app/wwctl/profile/set/main.go +++ b/internal/app/wwctl/profile/set/main.go @@ -257,20 +257,23 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } if len(profiles) > 0 { - q := fmt.Sprintf("Are you sure you want to modify %d profile(s)", len(profiles)) - - prompt := promptui.Prompt{ - Label: q, - IsConfirm: true, - } - - result, _ := prompt.Run() - - if result == "y" || result == "yes" { + if SetYes == true { nodeDB.Persist() - warewulfd.DaemonReload() - } + } else { + q := fmt.Sprintf("Are you sure you want to modify %d profile(s)", len(profiles)) + prompt := promptui.Prompt{ + Label: q, + IsConfirm: true, + } + + result, _ := prompt.Run() + + if result == "y" || result == "yes" { + nodeDB.Persist() + warewulfd.DaemonReload() + } + } } else { fmt.Printf("No profiles found\n") } diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index 9eadcb8f..6d81f861 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -11,6 +11,7 @@ var ( RunE: CobraRunE, } SetAll bool + SetYes bool SetForce bool SetComment string SetContainer string @@ -64,6 +65,7 @@ func init() { baseCmd.PersistentFlags().BoolVarP(&SetAll, "all", "a", false, "Set all profiles") baseCmd.PersistentFlags().BoolVarP(&SetForce, "force", "f", false, "Force configuration (even on error)") + baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked") } // GetRootCommand returns the root cobra.Command for the application.