Remove persist option from configure commands

This commit is contained in:
Gregory Kurtzer
2021-04-23 21:06:57 -07:00
parent d1bc747cc2
commit 19d4fec376
11 changed files with 42 additions and 51 deletions

View File

@@ -13,11 +13,6 @@ import (
)
func CobraRunE(cmd *cobra.Command, args []string) error {
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
return Configure(SetShow)
}
@@ -33,7 +28,7 @@ func Configure(show bool) error {
os.Exit(1)
}
if util.IsDir(controller.Tftp.TftpRoot) == false {
if !util.IsDir(controller.Tftp.TftpRoot) {
wwlog.Printf(wwlog.ERROR, "Configured TFTP Root directory does not exist: %s\n", controller.Tftp.TftpRoot)
os.Exit(1)
}
@@ -44,7 +39,7 @@ func Configure(show bool) error {
os.Exit(1)
}
if show == false {
if !show {
fmt.Printf("Writing PXE files to: %s\n", path.Join(controller.Tftp.TftpRoot, "warewulf"))
err = staticfiles.WriteData("files/tftp/x86.efi", path.Join(controller.Tftp.TftpRoot, "warewulf/x86.efi"))
if err != nil {

View File

@@ -10,13 +10,11 @@ var (
"on your Warewulf master.",
RunE: CobraRunE,
}
SetShow bool
SetPersist bool
SetShow bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetPersist, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.