added wwctl genconfig warewulfconf print

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-03 14:07:26 +01:00
parent 78978ad233
commit 32b4bb74cc
6 changed files with 71 additions and 27 deletions

View File

@@ -0,0 +1,19 @@
package print
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
)
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
conf := warewulfconf.New()
buffer, err := yaml.Marshal(&conf)
if err != nil {
return
}
fmt.Println(string(buffer))
return
}

View File

@@ -0,0 +1,22 @@
package print
import (
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
Use: "print",
Short: "print wareweulf.conf",
Long: "This command prints the actual used warewulf.conf, can be used to create an empty valid warewulf.conf",
RunE: CobraRunE,
Args: cobra.ExactArgs(0),
}
)
func init() {
}
func GetCommand() *cobra.Command {
return baseCmd
}