Moved ready command to node ready
This commit is contained in:
@@ -80,11 +80,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if ShowIpmi {
|
} else if ShowIpmi {
|
||||||
fmt.Printf("%-22s %-16s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD IPMI INTERFACE")
|
fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD", "IPMI INTERFACE")
|
||||||
fmt.Println(strings.Repeat("=", 80))
|
fmt.Println(strings.Repeat("=", 80))
|
||||||
|
|
||||||
for _, node := range node.FilterByName(nodes, args) {
|
for _, node := range node.FilterByName(nodes, args) {
|
||||||
fmt.Printf("%-22s %-16s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print())
|
fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print())
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ShowLong {
|
} else if ShowLong {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/hpcng/warewulf/internal/app/wwctl/node/console"
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/console"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/node/delete"
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/delete"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/node/list"
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/list"
|
||||||
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/ready"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/node/sensors"
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/sensors"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/node/set"
|
"github.com/hpcng/warewulf/internal/app/wwctl/node/set"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -25,6 +26,7 @@ func init() {
|
|||||||
baseCmd.AddCommand(add.GetCommand())
|
baseCmd.AddCommand(add.GetCommand())
|
||||||
baseCmd.AddCommand(delete.GetCommand())
|
baseCmd.AddCommand(delete.GetCommand())
|
||||||
baseCmd.AddCommand(console.GetCommand())
|
baseCmd.AddCommand(console.GetCommand())
|
||||||
|
baseCmd.AddCommand(ready.GetCommand())
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRootCommand returns the root cobra.Command for the application.
|
// GetRootCommand returns the root cobra.Command for the application.
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
package ready
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/config"
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/container"
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/kernel"
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/node"
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
|
||||||
|
|
||||||
n, err := node.New()
|
|
||||||
if err != nil {
|
|
||||||
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes, err := n.FindAllNodes()
|
|
||||||
if err != nil {
|
|
||||||
wwlog.Printf(wwlog.ERROR, "Cloud not get nodeList: %s\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("%-25s %-10s %-6s %-6s %-6s %-6s %-6s\n", "NODE NAME", "READY", "VNFS", "KERNEL", "KMODS", "SYS-OL", "RUN-OL")
|
|
||||||
|
|
||||||
for _, node := range nodes {
|
|
||||||
var vnfs_good bool
|
|
||||||
var kernel_good bool
|
|
||||||
var kmods_good bool
|
|
||||||
var systemo_good bool
|
|
||||||
var runtimeo_good bool
|
|
||||||
ready := true
|
|
||||||
|
|
||||||
if node.ContainerName.Get() != "" {
|
|
||||||
vnfsImage := container.ImageFile(node.ContainerName.Get())
|
|
||||||
|
|
||||||
if util.IsFile(vnfsImage) == true {
|
|
||||||
vnfs_good = true
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "VNFS not found: %s, %s\n", node.Id.Get(), vnfsImage)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node Kernel not defined: %s\n", node.Id.Get())
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.KernelVersion.Get() != "" {
|
|
||||||
if util.IsFile(kernel.KernelImage(node.KernelVersion.Get())) == true {
|
|
||||||
kernel_good = true
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node Kernel not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get())
|
|
||||||
}
|
|
||||||
if util.IsFile(kernel.KmodsImage(node.KernelVersion.Get())) == true {
|
|
||||||
kmods_good = true
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node Kmods not found: %s, %s\n", node.Id.Get(), node.KernelVersion.Get())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node Kernel version not defined: %s\n", node.Id.Get())
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.SystemOverlay.Get() != "" {
|
|
||||||
if util.IsFile(config.SystemOverlayImage(node.Id.Get())) == true {
|
|
||||||
systemo_good = true
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", config.SystemOverlayImage(node.Id.Get()))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "System Overlay not defined: %s\n", node.Id.Get())
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.RuntimeOverlay.Get() != "" {
|
|
||||||
if util.IsFile(config.RuntimeOverlayImage(node.Id.Get())) == true {
|
|
||||||
runtimeo_good = true
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", config.RuntimeOverlaySource(node.Id.Get()))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ready = false
|
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not defined: %s\n", node.Id.Get())
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("%-25s %-10t %-6t %-6t %-6t %-6t %-6t\n", node.Id.Get(), ready, vnfs_good, kernel_good, kmods_good, systemo_good, runtimeo_good)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package ready
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
baseCmd = &cobra.Command{
|
|
||||||
Use: "ready",
|
|
||||||
Short: "Warewulf Status Check",
|
|
||||||
RunE: CobraRunE,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetRootCommand returns the root cobra.Command for the application.
|
|
||||||
func GetCommand() *cobra.Command {
|
|
||||||
return baseCmd
|
|
||||||
}
|
|
||||||
@@ -8,11 +8,11 @@ import (
|
|||||||
"github.com/hpcng/warewulf/internal/app/wwctl/overlay"
|
"github.com/hpcng/warewulf/internal/app/wwctl/overlay"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/power"
|
"github.com/hpcng/warewulf/internal/app/wwctl/power"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/profile"
|
"github.com/hpcng/warewulf/internal/app/wwctl/profile"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/ready"
|
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/server"
|
"github.com/hpcng/warewulf/internal/app/wwctl/server"
|
||||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/cobra/doc"
|
"github.com/spf13/cobra/doc"
|
||||||
|
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,17 +31,13 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().BoolVarP(&verboseArg, "verbose", "v", false, "Run with increased verbosity.")
|
rootCmd.PersistentFlags().BoolVarP(&verboseArg, "verbose", "v", false, "Run with increased verbosity.")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&debugArg, "debug", "d", false, "Run with debugging messages enabled.")
|
rootCmd.PersistentFlags().BoolVarP(&debugArg, "debug", "d", false, "Run with debugging messages enabled.")
|
||||||
|
|
||||||
//rootCmd.AddCommand(build.GetCommand())
|
|
||||||
|
|
||||||
rootCmd.AddCommand(overlay.GetCommand())
|
rootCmd.AddCommand(overlay.GetCommand())
|
||||||
// rootCmd.AddCommand(controller.GetCommand())
|
|
||||||
rootCmd.AddCommand(container.GetCommand())
|
rootCmd.AddCommand(container.GetCommand())
|
||||||
rootCmd.AddCommand(node.GetCommand())
|
rootCmd.AddCommand(node.GetCommand())
|
||||||
rootCmd.AddCommand(kernel.GetCommand())
|
rootCmd.AddCommand(kernel.GetCommand())
|
||||||
rootCmd.AddCommand(power.GetCommand())
|
rootCmd.AddCommand(power.GetCommand())
|
||||||
rootCmd.AddCommand(profile.GetCommand())
|
rootCmd.AddCommand(profile.GetCommand())
|
||||||
rootCmd.AddCommand(configure.GetCommand())
|
rootCmd.AddCommand(configure.GetCommand())
|
||||||
rootCmd.AddCommand(ready.GetCommand())
|
|
||||||
rootCmd.AddCommand(server.GetCommand())
|
rootCmd.AddCommand(server.GetCommand())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user