Merge pull request #127 from gmkurtzer/updates_for_docs

Updates for docs
This commit is contained in:
Gregory M. Kurtzer
2021-09-15 12:29:32 -07:00
committed by GitHub
5 changed files with 8 additions and 80 deletions

View File

@@ -32,13 +32,13 @@ 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())
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) {

View File

@@ -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())

View File

@@ -30,10 +30,10 @@ 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(), "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())

View File

@@ -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())

View File

@@ -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)