Files
warewulf/internal/app/wwctl/node/list/main.go
Christian Goll b485ea999f removed optionStrMap in favor of NodeConf
openStrMap is a map[string]string which is sent arround. This is now
done by using a unmarshalled NodeConf instead.
2022-08-18 19:22:55 +02:00

31 lines
683 B
Go

package list
import (
"fmt"
apinode "github.com/hpcng/warewulf/internal/pkg/api/node"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
req := wwapiv1.GetNodeList{
Nodes: args,
Type: wwapiv1.GetNodeList_Simple,
}
if ShowAll {
req.Type = wwapiv1.GetNodeList_All
} else if ShowIpmi {
req.Type = wwapiv1.GetNodeList_Ipmi
} else if ShowNet {
req.Type = wwapiv1.GetNodeList_Network
} else if ShowLong {
req.Type = wwapiv1.GetNodeList_Long
}
nodeInfo, err := apinode.NodeList(&req)
for _, str := range nodeInfo.Output {
fmt.Printf("%s\n", str)
}
return
}