UI Updates with a few minor fixups scattered here and there

This commit is contained in:
Gregory Kurtzer
2021-01-14 20:23:42 -08:00
parent 72a40c2eca
commit 72b1d8c9d8
67 changed files with 358 additions and 478 deletions

View File

@@ -23,6 +23,11 @@ type dhcpTemplate struct {
}
func CobraRunE(cmd *cobra.Command, args []string) error {
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
return Configure(SetShow)
}

View File

@@ -7,16 +7,18 @@ import (
var (
baseCmd = &cobra.Command{
Use: "dhcp",
Short: "DHCP configuration",
Long: "DHCP Config",
RunE: CobraRunE,
Short: "Manage and initialize DHCP",
Long: "DHCP is a dependent service to Warewulf. This command will configure DHCP as defined\n" +
"in the warewulf.conf file.",
RunE: CobraRunE,
}
SetShow bool
SetShow bool
SetPersist bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetShow, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -1,13 +1,14 @@
package hosts
import (
"bytes"
"fmt"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
"bytes"
"text/template"
)
@@ -15,12 +16,17 @@ type TemplateStruct struct {
PrevHostFile string
Ipaddr string
Fqdn string
AllNodes []node.NodeInfo
AllNodes []node.NodeInfo
}
func CobraRunE(cmd *cobra.Command, args []string) error {
var replace TemplateStruct
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
if util.IsFile("/etc/warewulf/hosts.tmpl") == false {
wwlog.Printf(wwlog.WARN, "Template not found, not updating host file\n")
return nil
@@ -50,7 +56,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.WARN, "%s\n", err)
} else {
// if /etc/hosts.ww does not exist, backup /etc/hosts to /etc/hosts.wwbackup
if ! util.IsFile("/etc/hosts.wwbackup") {
if !util.IsFile("/etc/hosts.wwbackup") {
err = util.CopyFile("/etc/hosts", "/etc/hosts.wwbackup")
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)

View File

@@ -5,15 +5,18 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "hosts",
Short: "NFS configuration",
Long: "NFS Config",
RunE: CobraRunE,
Short: "Update the /etc/hosts file",
Long: "Write out the /etc/hosts file based on the Warewulf template (hosts.tmpl) in the\n" +
"Warewulf configuration directory.",
RunE: CobraRunE,
}
SetShow bool
SetShow bool
SetPersist bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetShow, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -11,6 +11,11 @@ import (
func CobraRunE(cmd *cobra.Command, args []string) error {
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
controller, err := warewulfconf.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)

View File

@@ -5,15 +5,18 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "nfs",
Short: "NFS configuration",
Long: "NFS Config",
RunE: CobraRunE,
Short: "Manage and initialize NFS",
Long: "NFS is an optional dependent service of Warewulf, this tool will automatically\n" +
"configure NFS as per the configuration in the warewulf.conf file.",
RunE: CobraRunE,
}
SetShow bool
SetShow bool
SetPersist bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetPersist, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -14,9 +14,10 @@ import (
var (
baseCmd = &cobra.Command{
Use: "configure",
Short: "Configure Warewulf services",
Long: "Warewulf Service Initialization",
RunE: CobraRunE,
Short: "Manage system services",
Long: "This application allows you to manage and initialize Warewulf dependent system\n" +
"services based on the configuration in the warewulf.conf file.",
RunE: CobraRunE,
}
SetDoAll bool
)

View File

@@ -10,6 +10,10 @@ import (
)
func CobraRunE(cmd *cobra.Command, args []string) error {
if SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
if os.Getuid() == 0 {
fmt.Printf("Updating system keys\n")

View File

@@ -5,16 +5,17 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "ssh",
Short: "SSH configuration",
Long: "SSH Config",
RunE: CobraRunE,
Short: "Manage and initialize SSH",
Long: "SSH is an optionally dependent service for Warewulf, this tool will automatically\n" +
"setup the ssh keys nodes using the 'default' system overlay as well as user owned\n" +
"keys.",
RunE: CobraRunE,
}
SetShow bool
SetPersist bool
)
func init() {
// baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetPersist, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -12,6 +12,11 @@ import (
)
func CobraRunE(cmd *cobra.Command, args []string) error {
if SetShow == false && SetPersist == false {
fmt.Println(cmd.Help())
os.Exit(0)
}
return Configure(SetShow)
}

View File

@@ -5,15 +5,18 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "tftp",
Short: "TFTP configuration",
Long: "TFTP Config",
RunE: CobraRunE,
Short: "Manage and initialize TFTP",
Long: "TFTP is a dependent service of Warewulf, this tool will enable the tftp services\n" +
"on your Warewulf master.",
RunE: CobraRunE,
}
SetShow bool
SetShow bool
SetPersist bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
baseCmd.PersistentFlags().BoolVar(&SetPersist, "persist", false, "Persist the configuration and initialize the service")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -18,6 +18,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
containers = args
}
if len(containers) == 0 {
fmt.Println(cmd.Help())
os.Exit(0)
}
for _, c := range containers {
if container.ValidSource(c) == false {
wwlog.Printf(wwlog.ERROR, "VNFS name does not exist: %s\n", c)

View File

@@ -4,11 +4,11 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "build (container location | node search pattern)",
Short: "VNFS Image Build",
Long: "VNFS kernel images",
Use: "build [flags] [container name]...",
Short: "(Re)build a bootable VNFS image",
Long: "This command will build a bootable VNFS image from an imported container image.",
RunE: CobraRunE,
Args: cobra.RangeArgs(0, 1),
Args: cobra.MinimumNArgs(1),
}
BuildForce bool
BuildAll bool

View File

@@ -4,15 +4,12 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "delete",
Short: "Delete Source OCI VNFS images",
Long: "Delete Source OCI VNFS images ",
Use: "delete [flags] [container name]...",
Short: "Delete an imported container",
Long: "This command will delete a container that has been imported into Warewulf.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
SetForce bool
SetUpdate bool
SetBuild bool
)
func init() {

View File

@@ -7,9 +7,11 @@ import (
var (
baseCmd = &cobra.Command{
Use: "exec",
Short: "Spawn any command inside a Warewulf container",
Long: "Run a command inside a Warewulf container ",
Use: "exec [flags] [container name]",
Short: "Run a command inside of a Warewulf container",
Long: "This command will allow you to run any command inside of a given\n" +
"warewulf container. This is commonly used with an interactive shell such as /bin/bash\n" +
"to run a virtual environment within the container.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
@@ -18,7 +20,6 @@ var (
func init() {
baseCmd.AddCommand(child.GetCommand())
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -1,4 +1,4 @@
package pull
package imprt
import (
"fmt"

View File

@@ -1,14 +1,15 @@
package pull
package imprt
import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "pull",
Short: "Pull Source OCI VNFS images",
Long: "Pull Source OCI VNFS images ",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
Use: "import [flags] [container source URI]",
Short: "Import a container into Warewulf",
Long: "This command will pull and import a container into Warewulf so it can be used\n" +
"as a source to create a bootable VNFS image.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
SetForce bool
SetUpdate bool
@@ -21,7 +22,6 @@ func init() {
baseCmd.PersistentFlags().BoolVarP(&SetUpdate, "update", "u", false, "Update and overwrite an existing container")
baseCmd.PersistentFlags().BoolVarP(&SetBuild, "build", "b", false, "Build container when after pulling")
baseCmd.PersistentFlags().BoolVar(&SetDefault, "setdefault", false, "Set this container for the default profile")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -4,21 +4,14 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "list",
Short: "List VNFS images",
Long: "List VNFS images ",
RunE: CobraRunE,
Use: "list [flags]",
Short: "List imported Warewulf containers",
Long: "This command will show you the containers that are imported into Warewulf.",
RunE: CobraRunE,
Aliases: []string{"ls"},
}
SystemOverlay bool
BuildAll bool
)
func init() {
//baseCmd.PersistentFlags().BoolVarP(&SystemOverlay, "system", "s", false, "Show System Overlays as well")
//baseCmd.PersistentFlags().BoolVarP(&BuildAll, "all", "a", false, "Build all overlays (runtime and system)")
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -4,8 +4,8 @@ import (
"github.com/hpcng/warewulf/internal/app/wwctl/container/build"
"github.com/hpcng/warewulf/internal/app/wwctl/container/delete"
"github.com/hpcng/warewulf/internal/app/wwctl/container/exec"
"github.com/hpcng/warewulf/internal/app/wwctl/container/imprt"
"github.com/hpcng/warewulf/internal/app/wwctl/container/list"
"github.com/hpcng/warewulf/internal/app/wwctl/container/pull"
"github.com/spf13/cobra"
)
@@ -13,7 +13,9 @@ var (
baseCmd = &cobra.Command{
Use: "container",
Short: "Container / VNFS image management",
Long: "Virtual Node File System (VNFS) image management",
Long: "Starting with version 4, Warewulf uses containers to build the bootable VNFS\n" +
"images for nodes to boot. These commands will help you import, management, and\n" +
"transform containers into bootable Warewulf VNFS images.",
}
test bool
)
@@ -21,7 +23,7 @@ var (
func init() {
baseCmd.AddCommand(build.GetCommand())
baseCmd.AddCommand(list.GetCommand())
baseCmd.AddCommand(pull.GetCommand())
baseCmd.AddCommand(imprt.GetCommand())
baseCmd.AddCommand(exec.GetCommand())
baseCmd.AddCommand(delete.GetCommand())
}

View File

@@ -1,107 +0,0 @@
package build
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/kernel"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
for _, arg := range args {
output, err := kernel.Build(arg)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Failed building kernel: %s\n", err)
os.Exit(1)
} else {
fmt.Printf("%s: %s\n", arg, output)
}
}
if SetDefault == true {
if len(args) != 1 {
wwlog.Printf(wwlog.ERROR, "Can only set default for one kernel version\n")
} else {
nodeDB, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
os.Exit(1)
}
//TODO: Don't loop through profiles, instead have a nodeDB function that goes directly to the map
profiles, _ := nodeDB.FindAllProfiles()
for _, profile := range profiles {
wwlog.Printf(wwlog.DEBUG, "Looking for profile default: %s\n", profile.Id.Get())
if profile.Id.Get() == "default" {
wwlog.Printf(wwlog.DEBUG, "Found profile default, setting kernel version to: %s\n", args[0])
profile.KernelVersion.Set(args[0])
nodeDB.ProfileUpdate(profile)
}
}
nodeDB.Persist()
fmt.Printf("Set default kernel version to: %s\n", args[0])
}
}
/*
var nodes []node.NodeInfo
set := make(map[string]int)
n, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
os.Exit(1)
}
if len(args) == 1 && ByNode == true {
var err error
nodes, err = n.SearchByName(args[0])
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not find nodes for search term: %s\n", args[0])
os.Exit(1)
}
for _, node := range nodes {
if node.KernelVersion.Defined() == true {
set[node.KernelVersion.Get()]++
}
}
} else if BuildAll == true {
var err error
nodes, err = n.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not get list of nodes: %s\n", err)
os.Exit(1)
}
for _, node := range nodes {
wwlog.Printf(wwlog.DEBUG, "evaluating node/kernel: %s/%s\n", node.Id.Get(), node.KernelVersion.Get())
if node.KernelVersion.Defined() == true {
set[node.KernelVersion.Get()]++
}
}
} else if len(args) == 1 {
set[args[0]]++
} else {
cmd.Usage()
os.Exit(1)
}
for k := range set {
wwlog.Printf(wwlog.INFO, "Building kernel: %s\n", k)
err := kernel.Build(k)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
*/
return nil
}

View File

@@ -1,29 +0,0 @@
package build
import (
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
Use: "build (kernel version | node search pattern)",
Short: "Kernel Image Build",
Long: "Build kernel images",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
BuildAll bool
ByNode bool
SetDefault bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&BuildAll, "all", "a", false, "Build all overlays (runtime and system)")
baseCmd.PersistentFlags().BoolVarP(&ByNode, "node", "n", false, "Build overlay for a particular node(s)")
baseCmd.PersistentFlags().BoolVar(&SetDefault, "setdefault", false, "Set this kernel for the default profile")
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}

View File

@@ -1,12 +0,0 @@
package export
import (
"fmt"
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("This command is coming soon...\n")
return nil
}

View File

@@ -1,22 +0,0 @@
package export
import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "export",
Short: "Kernel Image Export",
Long: "Export kernel image",
RunE: CobraRunE,
Args: cobra.ExactArgs(1),
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}

View File

@@ -2,11 +2,49 @@ package imprt
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/kernel"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("This command is coming soon...\n")
for _, arg := range args {
output, err := kernel.Build(arg)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Failed building kernel: %s\n", err)
os.Exit(1)
} else {
fmt.Printf("%s: %s\n", arg, output)
}
}
if SetDefault == true {
if len(args) != 1 {
wwlog.Printf(wwlog.ERROR, "Can only set default for one kernel version\n")
} else {
nodeDB, err := node.New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
os.Exit(1)
}
//TODO: Don't loop through profiles, instead have a nodeDB function that goes directly to the map
profiles, _ := nodeDB.FindAllProfiles()
for _, profile := range profiles {
wwlog.Printf(wwlog.DEBUG, "Looking for profile default: %s\n", profile.Id.Get())
if profile.Id.Get() == "default" {
wwlog.Printf(wwlog.DEBUG, "Found profile default, setting kernel version to: %s\n", args[0])
profile.KernelVersion.Set(args[0])
nodeDB.ProfileUpdate(profile)
}
}
nodeDB.Persist()
fmt.Printf("Set default kernel version to: %s\n", args[0])
}
}
return nil
}
}

View File

@@ -1,22 +1,30 @@
package imprt
import "github.com/spf13/cobra"
import (
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
Use: "import",
Short: "Kernel Image Import",
Long: "Import kernel image",
RunE: CobraRunE,
Args: cobra.ExactArgs(1),
Use: "import [flags] [kernel version]",
Short: "Import Kernel version into Warewulf",
Long: "This will import a Kernel version from the control node into Warewulf for nodes\n" +
"to be configured to boot on.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
BuildAll bool
ByNode bool
SetDefault bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&BuildAll, "all", "a", false, "Build all overlays (runtime and system)")
baseCmd.PersistentFlags().BoolVarP(&ByNode, "node", "n", false, "Build overlay for a particular node(s)")
baseCmd.PersistentFlags().BoolVar(&SetDefault, "setdefault", false, "Set this kernel for the default profile")
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}
}

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"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"
"os"
@@ -26,53 +25,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
nodemap[n.KernelVersion.Get()]++
}
fmt.Printf("%-35s %-6s %-6s\n", "VNFS NAME", "BUILT", "NODES")
fmt.Printf("%-35s %-6s\n", "VNFS NAME", "NODE#")
for _, k := range kernels {
image := kernel.KernelImage(k)
if nodemap[k] == 0 {
nodemap[k] = 0
}
fmt.Printf("%-35s %-6t %-6d\n", k, util.IsFile(image), nodemap[k])
fmt.Printf("%-35s %6d\n", k, nodemap[k])
}
/*
nconfig, _ := node.New()
nodes, _ := nconfig.FindAllNodes()
nodemap := make(map[string]int)
for _, n := range nodes {
nodemap[n.KernelVersion.Get()]++
}
images, _ := ioutil.ReadDir(config.KernelParentDir())
fmt.Printf("%-38s %-16s %-16s %s\n", "KERNEL VERSION", "KERNEL SIZE(k)", "KMODS SIZE(k)", "NODES")
fmt.Println(strings.Repeat("=", 80))
for _, file := range images {
if util.IsDir(path.Join(config.KernelParentDir(), file.Name())) {
var kernel_size int64
var kmods_size int64
if util.IsFile(config.KernelImage(file.Name())) {
s, _ := os.Stat(config.KernelImage(file.Name()))
kernel_size = s.Size() / 1024
}
if util.IsFile(config.KmodsImage(file.Name())) {
s, _ := os.Stat(config.KmodsImage(file.Name()))
kmods_size = s.Size() / 1024
}
if nodemap[file.Name()] > 0 {
fmt.Printf("%-38s %-16d %-16d %d\n", file.Name(), kernel_size, kmods_size, nodemap[file.Name()])
} else {
fmt.Printf("%-38s %-16d %-16d %d\n", file.Name(), kernel_size, kmods_size, 0)
}
}
}
*/
return nil
}

View File

@@ -4,11 +4,12 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "list",
Short: "List Installed Kernel Images",
Long: "List installed kernel images",
RunE: CobraRunE,
Args: cobra.ExactArgs(0),
Use: "list [flags]",
Short: "List imported Kernel images",
Long: "This command will list the kernels that have been imported into Warewulf.",
RunE: CobraRunE,
Args: cobra.ExactArgs(0),
Aliases: []string{"ls"},
}
)
@@ -18,4 +19,4 @@ func init() {
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}
}

View File

@@ -1,8 +1,6 @@
package kernel
import (
"github.com/hpcng/warewulf/internal/app/wwctl/kernel/build"
"github.com/hpcng/warewulf/internal/app/wwctl/kernel/export"
"github.com/hpcng/warewulf/internal/app/wwctl/kernel/imprt"
"github.com/hpcng/warewulf/internal/app/wwctl/kernel/list"
"github.com/spf13/cobra"
@@ -10,15 +8,14 @@ import (
var (
baseCmd = &cobra.Command{
Use: "kernel",
Short: "Kernel Image Management",
Long: "Management of Warewulf Kernels to be used for bootstrapping nodes",
Use: "kernel",
Short: "Kernel Image Management",
Long: "This command is for management of Warewulf Kernels to be used for\n" +
"bootstrapping nodes",
}
)
func init() {
baseCmd.AddCommand(build.GetCommand())
baseCmd.AddCommand(export.GetCommand())
baseCmd.AddCommand(imprt.GetCommand())
baseCmd.AddCommand(list.GetCommand())
}
@@ -26,4 +23,4 @@ func init() {
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}
}

View File

@@ -4,9 +4,9 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "add",
Short: "Add new node",
Long: "Add new node ",
Use: "add [flags] [node pattern]",
Short: "Add new node to Warewulf",
Long: "This command will add a new node to Warewulf.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}

View File

@@ -6,9 +6,10 @@ import (
var (
powerCmd = &cobra.Command{
Use: "console",
Short: "IPMI console",
Long: "Start IPMI console for a singe node",
Use: "console [flags] [node pattern]",
Short: "Connect to IPMI console",
Long: "Start IPMI console for a singe node.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
}
)

View File

@@ -4,13 +4,15 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "delete",
Short: "Set node configurations",
Long: "Set node configurations ",
RunE: CobraRunE,
Use: "delete [flags] [node pattern]...",
Short: "Delete a node from Warewulf",
Long: "This command will remove a node from the Warewulf node configuration.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
Aliases: []string{"rm", "del"},
}
SetForce string
SetGroup string
SetForce string
SetGroup string
SetController string
)

View File

@@ -4,14 +4,15 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "list",
Short: "List all nodes",
Long: "List all nodes",
RunE: CobraRunE,
Use: "list [flags] (node pattern)",
Short: "List nodes matching pattern",
Long: "This command will show you configured nodes.",
RunE: CobraRunE,
Aliases: []string{"ls"},
}
ShowNet bool
ShowNet bool
ShowIpmi bool
ShowAll bool
ShowAll bool
ShowLong bool
)

View File

@@ -2,31 +2,23 @@ package node
import (
"github.com/hpcng/warewulf/internal/app/wwctl/node/add"
"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/list"
"github.com/hpcng/warewulf/internal/app/wwctl/node/poweron"
"github.com/hpcng/warewulf/internal/app/wwctl/node/poweroff"
"github.com/hpcng/warewulf/internal/app/wwctl/node/powercycle"
"github.com/hpcng/warewulf/internal/app/wwctl/node/powerstatus"
"github.com/hpcng/warewulf/internal/app/wwctl/node/sensors"
"github.com/hpcng/warewulf/internal/app/wwctl/node/console"
"github.com/hpcng/warewulf/internal/app/wwctl/node/set"
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
Use: "node",
Short: "Node management",
Long: "Management of node settings and power management",
Use: "node",
Short: "Node management",
Long: "Management of node settings",
}
)
func init() {
baseCmd.AddCommand(poweron.GetCommand())
baseCmd.AddCommand(poweroff.GetCommand())
baseCmd.AddCommand(powercycle.GetCommand())
baseCmd.AddCommand(powerstatus.GetCommand())
baseCmd.AddCommand(sensors.GetCommand())
baseCmd.AddCommand(list.GetCommand())
baseCmd.AddCommand(set.GetCommand())

View File

@@ -6,16 +6,17 @@ import (
var (
powerCmd = &cobra.Command{
Use: "sensors",
Short: "node sensor information",
Long: "Get Node Sensor Information",
Use: "sensors [flags] [node pattern]",
Short: "Show node's IPMI sensor information",
Long: "Show IPMI sensors for a single node.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
}
full bool
)
func init() {
powerCmd.PersistentFlags().BoolVarP(&full, "full", "F", false, "show detailed output.")
powerCmd.PersistentFlags().BoolVarP(&full, "full", "F", false, "show detailed output.")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -4,9 +4,10 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "set",
Short: "Set node configurations",
Long: "Set node configurations ",
Use: "set [flags] [node pattern]...",
Short: "Configure node properties",
Long: "This command will allow you to set configuration properties for nodes.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
}
SetComment string

View File

@@ -4,13 +4,14 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "build [overlay name]",
Short: "Build/Rebuild an overlay",
Long: "Build or rebuild a Warewulf overlay ",
RunE: CobraRunE,
Use: "build [flags] <overlay name>",
Short: "(Re)build an overlay",
Long: "This command will build a system or runtime overlay.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
}
SystemOverlay bool
BuildAll bool
BuildAll bool
)
func init() {

View File

@@ -4,21 +4,20 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "chmod [overlay name] [numeric mode] [file path]",
Short: "Change permissions within an overlay",
Long: "Change permissions within an overlay",
RunE: CobraRunE,
Args: cobra.ExactArgs(3),
Use: "chmod [flags] <overlay> <mode> <path>",
Short: "Change file permissions within an overlay",
Long: "This command will allow you to change the permissions of a file within an\n" +
"overlay.",
RunE: CobraRunE,
Args: cobra.ExactArgs(3),
}
SystemOverlay bool
SystemOverlay bool
NoOverlayUpdate bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SystemOverlay, "system", "s", false, "Show System Overlays as well")
baseCmd.PersistentFlags().BoolVarP(&NoOverlayUpdate, "noupdate", "n", false, "Don't update overlays")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -6,14 +6,13 @@ import (
var (
baseCmd = &cobra.Command{
Use: "create [overlay name]",
Short: "Initialize a new Overlay",
Long: "Create a new Warewulf provisioning overlay",
RunE: CobraRunE,
Args: cobra.ExactArgs(1),
Use: "create [flags] <overlay name>",
Short: "Initialize a new Overlay",
Long: "This command will create a new empty overlay.",
RunE: CobraRunE,
Args: cobra.ExactArgs(1),
}
SystemOverlay bool
SystemOverlay bool
NoOverlayUpdate bool
)

View File

@@ -6,16 +6,17 @@ import (
var (
baseCmd = &cobra.Command{
Use: "delete [overlay name]",
Short: "Delete Warewulf Overlay files",
Long: "Warewulf Delete overlay files",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
Aliases: []string{"rm", "del"},
Use: "delete [flags] <overlay name> [overlay file]",
Short: "Delete Warewulf Overlay or files",
Long: "This command will delete files within an overlay or an entire overlay if no\n" +
"files are given to remove (use with caution).",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
Aliases: []string{"rm", "del"},
}
SystemOverlay bool
Force bool
Parents bool
SystemOverlay bool
Force bool
Parents bool
NoOverlayUpdate bool
)
@@ -30,4 +31,3 @@ func init() {
func GetCommand() *cobra.Command {
return baseCmd
}

View File

@@ -6,17 +6,18 @@ import (
var (
baseCmd = &cobra.Command{
Use: "edit [overlay name] [file path]",
Short: "Edit Warewulf Overlay files",
Long: "Warewulf edit overlay files",
RunE: CobraRunE,
Args: cobra.ExactArgs(2),
Use: "edit [flags] <overlay name> <file path>",
Short: "Edit/Create a file within a Warewulf Overlay",
Long: "This command will allow you to edit or create a new file within a given\n" +
"overlay. Note: when creating files ending in a '.ww' suffix this will always be\n" +
"parsed as a Warewulf template file, and the suffix will be removed automatically.",
RunE: CobraRunE,
Args: cobra.ExactArgs(2),
}
SystemOverlay bool
ListFiles bool
CreateDirs bool
PermMode int32
SystemOverlay bool
ListFiles bool
CreateDirs bool
PermMode int32
NoOverlayUpdate bool
)
@@ -32,5 +33,3 @@ func init() {
func GetCommand() *cobra.Command {
return baseCmd
}

View File

@@ -4,15 +4,15 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "import [overlay name] [source file] (dest location)",
Short: "Import Warewulf Overlay files",
Long: "Warewulf Import overlay files",
RunE: CobraRunE,
Args: cobra.RangeArgs(2, 3),
Aliases: []string{"cp"},
Use: "import [flags] <overlay name> <source file> [dest location]",
Short: "Import a file into a Warewulf Overlay",
Long: "This command will import a file into a given Warewulf overlay.",
RunE: CobraRunE,
Args: cobra.RangeArgs(2, 3),
Aliases: []string{"cp"},
}
SystemOverlay bool
PermMode int32
SystemOverlay bool
PermMode int32
NoOverlayUpdate bool
)

View File

@@ -6,15 +6,16 @@ import (
var (
baseCmd = &cobra.Command{
Use: "list",
Short: "List Warewulf Overlays",
Long: "Warewulf List overlay",
RunE: CobraRunE,
Aliases: []string{"ls"},
Use: "list [flags] [overlay name]",
Short: "List Warewulf Overlays and files",
Long: "This command will show you information about Warewulf overlays and the\n" +
"files contained within.",
RunE: CobraRunE,
Aliases: []string{"ls"},
}
SystemOverlay bool
ListContents bool
ListLong bool
ListContents bool
ListLong bool
)
func init() {

View File

@@ -6,14 +6,14 @@ import (
var (
baseCmd = &cobra.Command{
Use: "mkdir [overlay name] [directory path]",
Short: "Create a new directory",
Long: "Create a new directory within a Warewulf overlay",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(2),
Use: "mkdir [flags] <overlay name> <directory path>",
Short: "Create a new directory within an Overlay",
Long: "This command will allow you to create a new file within a given Warewulf overlay.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(2),
}
SystemOverlay bool
PermMode int32
SystemOverlay bool
PermMode int32
NoOverlayUpdate bool
)

View File

@@ -15,16 +15,14 @@ import (
var (
baseCmd = &cobra.Command{
Use: "overlay",
Short: "Warewulf Overlay Management",
Long: "Management interface for Warewulf overlays",
Use: "overlay",
Short: "Warewulf Overlay Management",
Long: "Management interface for Warewulf overlays",
}
test bool
)
func init() {
// baseCmd.PersistentFlags().BoolVarP(&test, "test", "t", false, "Testing.")
baseCmd.AddCommand(list.GetCommand())
baseCmd.AddCommand(show.GetCommand())
baseCmd.AddCommand(create.GetCommand())

View File

@@ -6,12 +6,13 @@ import (
var (
baseCmd = &cobra.Command{
Use: "show",
Short: "Show Warewulf Overlay objects",
Long: "Warewulf show overlay objects",
RunE: CobraRunE,
Aliases: []string{"cat"},
Args: cobra.ExactArgs(2),
Use: "show [flags] <overlay name> <overlay file>",
Short: "Show (cat) a file within a Warewulf Overlay",
Long: "This command will output the contents of a file within a given\n" +
"Warewulf overlay.",
RunE: CobraRunE,
Aliases: []string{"cat"},
Args: cobra.ExactArgs(2),
}
SystemOverlay bool
)
@@ -23,4 +24,4 @@ func init() {
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}
}

View File

@@ -6,9 +6,9 @@ import (
var (
powerCmd = &cobra.Command{
Use: "powercycle",
Short: "power cycle node(s)",
Long: "cycle power for one or more nodes",
Use: "cycle [flags] <node pattern>...",
Short: "Power cycle the given node(s)",
Long: "This command will cycle the power for a given set of nodes.",
RunE: CobraRunE,
}
)

View File

@@ -6,9 +6,9 @@ import (
var (
powerCmd = &cobra.Command{
Use: "poweroff",
Short: "power off node(s)",
Long: "turn power off for one or more nodes",
Use: "off",
Short: "Power off the given node(s)",
Long: "This command will shutdown the power to a given set of nodes.",
RunE: CobraRunE,
}
)

View File

@@ -6,9 +6,9 @@ import (
var (
powerCmd = &cobra.Command{
Use: "poweron",
Short: "power on node(s)",
Long: "turn power on for one or more nodes",
Use: "on",
Short: "Power on the given node(s)",
Long: "This command will power on a given set of nodes.",
RunE: CobraRunE,
}
)

View File

@@ -0,0 +1,32 @@
package power
import (
powercycle "github.com/hpcng/warewulf/internal/app/wwctl/power/cycle"
poweroff "github.com/hpcng/warewulf/internal/app/wwctl/power/off"
poweron "github.com/hpcng/warewulf/internal/app/wwctl/power/on"
powerstatus "github.com/hpcng/warewulf/internal/app/wwctl/power/status"
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
Use: "power",
Short: "Warewulf node power management",
Long: "This command can control the power state of nodes.",
}
test bool
)
func init() {
// baseCmd.PersistentFlags().BoolVarP(&test, "test", "t", false, "Testing.")
baseCmd.AddCommand(powercycle.GetCommand())
baseCmd.AddCommand(poweroff.GetCommand())
baseCmd.AddCommand(poweron.GetCommand())
baseCmd.AddCommand(powerstatus.GetCommand())
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}

View File

@@ -6,9 +6,9 @@ import (
var (
powerCmd = &cobra.Command{
Use: "powerstatus",
Short: "node power status",
Long: "Get Node Power Status",
Use: "status",
Short: "Show power status for the given node(s)",
Long: "This command will show the power status of a given set of nodes.",
RunE: CobraRunE,
}
)

View File

@@ -4,16 +4,14 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "add",
Short: "Add profiles",
Long: "Profile configurations ",
RunE: CobraRunE,
Use: "add [flags] <profile name>",
Short: "Add a new node profile",
Long: "This command will add a new node profile.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -4,16 +4,14 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "delete",
Short: "Delete profiles",
Long: "Profile configurations ",
RunE: CobraRunE,
Use: "delete [flags] <profile pattern>",
Short: "Delete a node profile",
Long: "This command will delete a node profile.",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -4,16 +4,14 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "list",
Short: "List profiles",
Long: "Profile configurations ",
RunE: CobraRunE,
Use: "list [flags] [profile pattern]...",
Short: "List profiles and configurations",
Long: "This command will list and show the profile configurations.",
RunE: CobraRunE,
Aliases: []string{"ls"},
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -10,11 +10,10 @@ import (
var (
baseCmd = &cobra.Command{
Use: "profile",
Short: "Management of node configuration profiles",
Long: "Warewulf profiles...",
Use: "profile",
Short: "Node configuration profile management",
Long: "Management of node profile settings",
}
test bool
)
func init() {

View File

@@ -4,9 +4,10 @@ import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
Use: "set",
Short: "Set profile configurations",
Long: "Profile configurations ",
Use: "set [flags] <profile pattern>...",
Short: "Configure node profile properties",
Long: "This command will allow you to set configuration properties for node profiles.",
Args: cobra.MinimumNArgs(1),
RunE: CobraRunE,
}
SetAll bool

View File

@@ -8,14 +8,10 @@ var (
baseCmd = &cobra.Command{
Use: "ready",
Short: "Warewulf Status Check",
Long: "Warewulf Status Check",
RunE: CobraRunE,
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -6,10 +6,10 @@ import (
"github.com/hpcng/warewulf/internal/app/wwctl/kernel"
"github.com/hpcng/warewulf/internal/app/wwctl/node"
"github.com/hpcng/warewulf/internal/app/wwctl/overlay"
"github.com/hpcng/warewulf/internal/app/wwctl/power"
"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/pkg/wwlog"
"github.com/spf13/cobra"
)
@@ -36,7 +36,7 @@ func init() {
rootCmd.AddCommand(container.GetCommand())
rootCmd.AddCommand(node.GetCommand())
rootCmd.AddCommand(kernel.GetCommand())
// rootCmd.AddCommand(group.GetCommand())
rootCmd.AddCommand(power.GetCommand())
rootCmd.AddCommand(profile.GetCommand())
rootCmd.AddCommand(configure.GetCommand())
rootCmd.AddCommand(ready.GetCommand())

View File

@@ -11,7 +11,7 @@ var (
baseCmd = &cobra.Command{
Use: "server",
Short: "Warewulf server process commands",
Long: "Warewulf profiles...",
Long: "This command will allow you to control the Warewulf daemon process.",
}
test bool
)
@@ -20,7 +20,6 @@ func init() {
baseCmd.AddCommand(start.GetCommand())
baseCmd.AddCommand(status.GetCommand())
baseCmd.AddCommand(stop.GetCommand())
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -7,5 +7,9 @@ import (
func CobraRunE(cmd *cobra.Command, args []string) error {
return warewulfd.DaemonStart()
if SetForeground == true {
return warewulfd.RunServer()
} else {
return warewulfd.DaemonStart()
}
}

View File

@@ -6,12 +6,13 @@ var (
baseCmd = &cobra.Command{
Use: "start",
Short: "Start Warewulf server",
Long: "Warewulf Server ",
RunE: CobraRunE,
}
SetForeground bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&SetForeground, "foreground", "f", false, "Run daemon process in the foreground")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -6,14 +6,10 @@ var (
baseCmd = &cobra.Command{
Use: "status",
Short: "Warewulf server status",
Long: "Warewulf Server ",
RunE: CobraRunE,
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -6,14 +6,10 @@ var (
baseCmd = &cobra.Command{
Use: "stop",
Short: "Stop Warewulf server",
Long: "Warewulf Server ",
RunE: CobraRunE,
}
)
func init() {
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd

View File

@@ -46,7 +46,7 @@ func FindSystemOverlays() ([]string, error) {
}
func FindRuntimeOverlays() ([]string, error) {
return findAllOverlays("system")
return findAllOverlays("runtime")
}
func SystemOverlayInit(name string) error {