rebased for the use without NodeInfo
make fanout configureable via commanline Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
@@ -5,14 +5,22 @@ import (
|
||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||
)
|
||||
|
||||
var (
|
||||
powerCmd = &cobra.Command{
|
||||
type variables struct {
|
||||
Showcmd bool
|
||||
Full bool
|
||||
Fanout int
|
||||
}
|
||||
|
||||
func GetCommand() *cobra.Command {
|
||||
vars := variables{}
|
||||
|
||||
powerCmd := &cobra.Command{
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "sensors [OPTIONS] PATTERN",
|
||||
Short: "Show node IPMI sensor information",
|
||||
Long: "Show IPMI sensor information for nodes matching PATTERN.",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: CobraRunE,
|
||||
RunE: CobraRunE(&vars),
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
@@ -27,14 +35,8 @@ var (
|
||||
return node_names, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
}
|
||||
full bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
powerCmd.PersistentFlags().BoolVarP(&full, "full", "F", false, "show detailed output.")
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
powerCmd.PersistentFlags().BoolVarP(&vars.Full, "full", "F", false, "show detailed output.")
|
||||
powerCmd.PersistentFlags().BoolVarP(&vars.Showcmd, "show", "s", false, "only show command which will be executed")
|
||||
powerCmd.PersistentFlags().IntVar(&vars.Fanout, "fanout", 50, "how many command should be executed in parallel")
|
||||
return powerCmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user