Merge --kerneloverride into --kernelversion
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
8f21d54243
commit
a844379bc5
@@ -8,26 +8,6 @@ import (
|
||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||
)
|
||||
|
||||
func NodeKernelOverride(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var kernelPaths []string
|
||||
registry, err := node.New()
|
||||
if err != nil {
|
||||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
nodes := hostlist.Expand(args)
|
||||
for _, id := range nodes {
|
||||
if node_, err := registry.GetNode(id); err != nil {
|
||||
continue
|
||||
} else if node_.ContainerName != "" {
|
||||
kernels := kernel.FindKernels(node_.ContainerName)
|
||||
for _, kernel_ := range kernels {
|
||||
kernelPaths = append(kernelPaths, kernel_.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
func NodeKernelVersion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var kernelVersions []string
|
||||
registry, err := node.New()
|
||||
@@ -41,32 +21,13 @@ func NodeKernelVersion(cmd *cobra.Command, args []string, toComplete string) ([]
|
||||
} else if node_.ContainerName != "" {
|
||||
kernels := kernel.FindKernels(node_.ContainerName)
|
||||
for _, kernel_ := range kernels {
|
||||
kernelVersions = append(kernelVersions, kernel_.Version())
|
||||
kernelVersions = append(kernelVersions, kernel_.Version(), kernel_.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
func ProfileKernelOverride(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var kernelPaths []string
|
||||
registry, err := node.New()
|
||||
if err != nil {
|
||||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
for _, id := range args {
|
||||
if profile, err := registry.GetProfile(id); err != nil {
|
||||
continue
|
||||
} else if profile.ContainerName != "" {
|
||||
kernels := kernel.FindKernels(profile.ContainerName)
|
||||
for _, kernel_ := range kernels {
|
||||
kernelPaths = append(kernelPaths, kernel_.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
func ProfileKernelVersion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var kernelVersions []string
|
||||
registry, err := node.New()
|
||||
@@ -79,7 +40,7 @@ func ProfileKernelVersion(cmd *cobra.Command, args []string, toComplete string)
|
||||
} else if profile.ContainerName != "" {
|
||||
kernels := kernel.FindKernels(profile.ContainerName)
|
||||
for _, kernel_ := range kernels {
|
||||
kernelVersions = append(kernelVersions, kernel_.Version())
|
||||
kernelVersions = append(kernelVersions, kernel_.Version(), kernel_.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user