added warewuld configure option

Co-authored-by: Jonathon Anderson <janderson@ciq.com>
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Christian Goll
2025-07-25 15:53:17 +02:00
committed by Jonathon Anderson
parent f2d06d5928
commit 2c51ca7fff
9 changed files with 174 additions and 16 deletions

View File

@@ -20,33 +20,32 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if allFunctions {
err = configure.WAREWULFD()
if err != nil {
return err
}
err = configure.DHCP()
if err != nil {
wwlog.Error("%s", err)
os.Exit(1)
return err
}
err = configure.NFS()
if err != nil {
wwlog.Error("%s", err)
os.Exit(1)
return err
}
err = configure.SSH(warewulfconf.Get().SSH.KeyTypes...)
if err != nil {
wwlog.Error("%s", err)
os.Exit(1)
return err
}
err = configure.TFTP()
if err != nil {
wwlog.Error("%s", err)
os.Exit(1)
return err
}
err = configure.Hostfile()
if err != nil {
wwlog.Error("%s", err)
os.Exit(1)
return err
}
} else {

View File

@@ -7,6 +7,7 @@ import (
"github.com/warewulf/warewulf/internal/app/wwctl/configure/nfs"
"github.com/warewulf/warewulf/internal/app/wwctl/configure/ssh"
"github.com/warewulf/warewulf/internal/app/wwctl/configure/tftp"
"github.com/warewulf/warewulf/internal/app/wwctl/configure/warewulfd"
)
var (
@@ -28,6 +29,7 @@ func init() {
baseCmd.AddCommand(ssh.GetCommand())
baseCmd.AddCommand(nfs.GetCommand())
baseCmd.AddCommand(hostfile.GetCommand())
baseCmd.AddCommand(warewulfd.GetCommand())
baseCmd.Flags().BoolVarP(&allFunctions, "all", "a", false, "Configure all services")
}

View File

@@ -0,0 +1,10 @@
package warewulfd
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/pkg/configure"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
return configure.WAREWULFD()
}

View File

@@ -0,0 +1,23 @@
package warewulfd
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
)
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "warewulfd [OPTIONS]",
Short: "Enable and start warewulfd",
Long: "Enable and starts the warewulfd service.",
RunE: CobraRunE,
Args: cobra.NoArgs,
ValidArgsFunction: completions.None,
}
)
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}