From 859bbcc316b74d1a338b8e544ea04a930ddd190f Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 12 Sep 2021 13:35:49 -0700 Subject: [PATCH 1/4] Be more consistent with UI nomenclature with kernel and container --- internal/app/wwctl/node/list/main.go | 6 +++--- internal/app/wwctl/profile/list/main.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index bdc9ceaf..97ee8372 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -37,8 +37,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %t\n", node.Id.Get(), "Discoverable", node.Discoverable.Source(), node.Discoverable.PrintB()) - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "ContainerName", node.ContainerName.Source(), node.ContainerName.Print()) - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "KernelVersion", node.KernelVersion.Source(), node.KernelVersion.Print()) + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Container", node.ContainerName.Source(), node.ContainerName.Print()) + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Kernel", node.KernelVersion.Source(), node.KernelVersion.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "KernelArgs", node.KernelArgs.Source(), node.KernelArgs.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "RuntimeOverlay", node.RuntimeOverlay.Source(), node.RuntimeOverlay.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "SystemOverlay", node.SystemOverlay.Source(), node.SystemOverlay.Print()) @@ -89,7 +89,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } } else if ShowLong { - fmt.Printf("%-22s %-26s %-35s %s\n", "NODE NAME", "KERNEL VERSION", "CONTAINER", "OVERLAYS (S/R)") + fmt.Printf("%-22s %-26s %-35s %s\n", "NODE NAME", "KERNEL", "CONTAINER", "OVERLAYS (S/R)") fmt.Println(strings.Repeat("=", 120)) for _, node := range node.FilterByName(nodes, args) { diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index 54c11ea7..13e54640 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -32,8 +32,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Comment", profile.Comment.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "ClusterName", profile.ClusterName.Print()) - fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "ContainerName", profile.ContainerName.Print()) - fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "KernelVersion", profile.KernelVersion.Print()) + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Container", profile.ContainerName.Print()) + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Kernel", profile.KernelVersion.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "KernelArgs", profile.KernelArgs.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Init", profile.Init.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Root", profile.Root.Print()) From 60155cf127f7aca964c13da60a6db29c6291e70a Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 12 Sep 2021 14:15:54 -0700 Subject: [PATCH 2/4] these validity checks were causing problems with undefining configurations. Removing these for now, as we will trust the user with doing the right thing. --- internal/app/wwctl/node/set/main.go | 54 -------------------------- internal/app/wwctl/profile/set/main.go | 19 --------- 2 files changed, 73 deletions(-) diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index aeb41367..1e87ce3d 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -5,7 +5,6 @@ import ( "os" "strings" - "github.com/hpcng/warewulf/internal/pkg/container" "github.com/hpcng/warewulf/internal/pkg/node" "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/warewulfd" @@ -46,59 +45,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } - if SetContainer != "" { - if container.ValidSource(SetContainer) { - imageFile := container.ImageFile(SetContainer) - if !util.IsFile(imageFile) { - wwlog.Printf(wwlog.ERROR, "Container has not been built: %s\n", SetContainer) - if !SetForce { - os.Exit(1) - } - } - } else { - wwlog.Printf(wwlog.ERROR, "Container does not exist: %s\n", SetContainer) - if !SetForce { - os.Exit(1) - } - } - } - - if SetProfile != "" { - profiles, _ := nodeDB.FindAllProfiles() - for _, r := range strings.Split(SetProfile, ",") { - var match bool - - for _, p := range profiles { - if p.Id.Get() == r || SetForce { - match = true - SetProfiles = append(SetProfiles, r) - } - } - - if !match { - wwlog.Printf(wwlog.WARN, "Requested profile is undefined: %s\n", r) - } - } - } - - if len(SetAddProfile) > 0 { - profiles, _ := nodeDB.FindAllProfiles() - for _, r := range SetAddProfile { - var match bool - - for _, p := range profiles { - if p.Id.Get() == r || SetForce { - match = true - } - } - - if !match { - wwlog.Printf(wwlog.WARN, "Requested profile is undefined: %s\n", r) - SetAddProfile = util.SliceRemoveElement(SetAddProfile, r) - } - } - } - for _, n := range nodes { wwlog.Printf(wwlog.VERBOSE, "Evaluating node: %s\n", n.Id.Get()) diff --git a/internal/app/wwctl/profile/set/main.go b/internal/app/wwctl/profile/set/main.go index 708a8b26..246b7b15 100644 --- a/internal/app/wwctl/profile/set/main.go +++ b/internal/app/wwctl/profile/set/main.go @@ -4,9 +4,7 @@ import ( "fmt" "os" - "github.com/hpcng/warewulf/internal/pkg/container" "github.com/hpcng/warewulf/internal/pkg/node" - "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/warewulfd" "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/manifoldco/promptui" @@ -44,23 +42,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(1) } - if SetContainer != "" { - if container.ValidSource(SetContainer) { - imageFile := container.ImageFile(SetContainer) - if !util.IsFile(imageFile) { - wwlog.Printf(wwlog.ERROR, "Container has not been built: %s\n", SetContainer) - if !SetForce { - os.Exit(1) - } - } - } else { - wwlog.Printf(wwlog.ERROR, "Container name does not exist: %s\n", SetContainer) - if !SetForce { - os.Exit(1) - } - } - } - for _, p := range profiles { wwlog.Printf(wwlog.VERBOSE, "Modifying profile: %s\n", p.Id.Get()) From 20031c2cfb08ee4b5ce00e7b14469f5717a64a69 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 12 Sep 2021 14:25:43 -0700 Subject: [PATCH 3/4] More nomenclature cleanups --- internal/app/wwctl/node/list/main.go | 2 +- internal/app/wwctl/profile/list/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index 97ee8372..074c0501 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -32,7 +32,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %s\n", "NODE", "FIELD", "PROFILE", "VALUE") fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Id", node.Id.Source(), node.Id.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Comment", node.Comment.Source(), node.Comment.Print()) - fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "ClusterName", node.ClusterName.Source(), node.ClusterName.Print()) + fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Cluster", node.ClusterName.Source(), node.ClusterName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Profiles", "--", strings.Join(node.Profiles, ",")) fmt.Printf("%-20s %-18s %-12s %t\n", node.Id.Get(), "Discoverable", node.Discoverable.Source(), node.Discoverable.PrintB()) diff --git a/internal/app/wwctl/profile/list/main.go b/internal/app/wwctl/profile/list/main.go index 13e54640..f43a2046 100644 --- a/internal/app/wwctl/profile/list/main.go +++ b/internal/app/wwctl/profile/list/main.go @@ -30,7 +30,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %s\n", "PROFILE NAME", "FIELD", "VALUE") fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Id", profile.Id.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Comment", profile.Comment.Print()) - fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "ClusterName", profile.ClusterName.Print()) + fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Cluster", profile.ClusterName.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Container", profile.ContainerName.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Kernel", profile.KernelVersion.Print()) From 5bff8be72e3737323bce04ac54313d4e6d61ee56 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Sun, 12 Sep 2021 14:42:08 -0700 Subject: [PATCH 4/4] Clustername bug not showing up in profiles. Not sure how this bug has existed for so long without being noticed! CRAZY! --- internal/pkg/node/constructors.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 473c249d..7dd55277 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -184,6 +184,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) { p.Id.Set(name) p.Comment.Set(profile.Comment) + p.ClusterName.Set(profile.ClusterName) p.ContainerName.Set(profile.ContainerName) p.Ipxe.Set(profile.Ipxe) p.Init.Set(profile.Init)