Move wwctl kernel list to wwctl container kernels
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
098c288ce2
commit
6f4d33b19e
@@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- use templating mechanism for power commands. #1004
|
||||
- Document "known issues."
|
||||
- Add `wwctl <node|profile> <add|set> --kernelversion` to specify the desired kernel version or path. #1556
|
||||
- Add `wwctl container kernels` to list discovered kernels from containers. #1556
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -75,7 +76,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Bump github.com/opencontainers/runc from 1.1.12 to 1.1.14
|
||||
- Repurpose Kernel.Override to specify the path to the desired kernel within the container. #1556
|
||||
- Merge Kernel.Override into Kernel.Version to specify the desired kernel version or path. #1556
|
||||
- Repurpose `wwctl kernel list` to list discovered kernels from containers. #1556
|
||||
- Provide detected kernel version to overlay templates. #1556
|
||||
|
||||
### Removed
|
||||
@@ -85,7 +85,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Remove `wwctl server <start,stop,status,restart,reload>` #508
|
||||
- Remove `wwctl overlay build --host` #1419
|
||||
- Remove `wwctl overlay build --nodes` #1419
|
||||
- Remove `wwctl kernel <import|delete>` #1556
|
||||
- Remove `wwctl kernel` #1556
|
||||
- Remove `wwctl <node|profile> <add|set> --kerneloverride` #1556
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -3,6 +3,7 @@ package completions
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/warewulf/warewulf/internal/pkg/container"
|
||||
"github.com/warewulf/warewulf/internal/pkg/hostlist"
|
||||
"github.com/warewulf/warewulf/internal/pkg/kernel"
|
||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||
@@ -46,3 +47,8 @@ func ProfileKernelVersion(cmd *cobra.Command, args []string, toComplete string)
|
||||
}
|
||||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
func Containers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
sources, _ := container.ListSources()
|
||||
return sources, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package list
|
||||
package kernels
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
@@ -28,9 +28,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
sources, err := container.ListSources()
|
||||
if err != nil {
|
||||
return err
|
||||
var sources []string
|
||||
if len(args) == 0 {
|
||||
if sources_, err := container.ListSources(); err == nil {
|
||||
sources = sources_
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
sources = args
|
||||
}
|
||||
|
||||
t := table.New(cmd.OutOrStdout())
|
||||
@@ -1,4 +1,4 @@
|
||||
package list
|
||||
package kernels
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -52,6 +52,32 @@ container2 /boot/vmlinuz-5.14.0-284.30.1.el9_2.aarch64 5.14.0-284.
|
||||
container2 /boot/vmlinuz-5.14.0-362.24.1.el9_3.aarch64 5.14.0-362.24.1 false 0
|
||||
container2 /boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64 5.14.0-427.31.1 true 0
|
||||
container2 /boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64+debug 5.14.0-427.31.1 false 0
|
||||
`,
|
||||
},
|
||||
"single container": {
|
||||
files: map[string][]string{
|
||||
"container1": []string{
|
||||
"/boot/vmlinuz-5.14.0-427.18.1.el9_4.x86_64",
|
||||
"/boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64",
|
||||
"/boot/vmlinuz-4.14.0-427.18.1.el8_4.x86_64",
|
||||
},
|
||||
"container2": []string{
|
||||
"/boot/vmlinuz-0-rescue-eb46964329b146e39518c625feab3ea0",
|
||||
"/boot/vmlinuz-5.14.0-362.24.1.el9_3.aarch64",
|
||||
"/boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64+debug",
|
||||
"/boot/vmlinuz-5.14.0-284.30.1.el9_2.aarch64",
|
||||
"/boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64",
|
||||
},
|
||||
},
|
||||
args: []string{"container2"},
|
||||
stdout: `
|
||||
Container Kernel Version Preferred Nodes
|
||||
--------- ------ ------- --------- -----
|
||||
container2 /boot/vmlinuz-0-rescue-eb46964329b146e39518c625feab3ea0 -- false 0
|
||||
container2 /boot/vmlinuz-5.14.0-284.30.1.el9_2.aarch64 5.14.0-284.30.1 false 0
|
||||
container2 /boot/vmlinuz-5.14.0-362.24.1.el9_3.aarch64 5.14.0-362.24.1 false 0
|
||||
container2 /boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64 5.14.0-427.31.1 true 0
|
||||
container2 /boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64+debug 5.14.0-427.31.1 false 0
|
||||
`,
|
||||
},
|
||||
}
|
||||
@@ -1,22 +1,23 @@
|
||||
package list
|
||||
package kernels
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
|
||||
)
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "list [OPTIONS]",
|
||||
Short: "List available kernels",
|
||||
Use: "kernels [OPTIONS]",
|
||||
Short: "List available container kernels",
|
||||
Long: "This command lists the kernels that are available in the imported containers.",
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.ExactArgs(0),
|
||||
Aliases: []string{"ls"},
|
||||
Aliases: []string{"kernel"},
|
||||
ValidArgsFunction: completions.Containers,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/delete"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/exec"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/imprt"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/kernels"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/list"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/rename"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container/shell"
|
||||
@@ -35,6 +36,7 @@ func init() {
|
||||
baseCmd.AddCommand(syncuser.GetCommand())
|
||||
baseCmd.AddCommand(copy.GetCommand())
|
||||
baseCmd.AddCommand(rename.GetCommand())
|
||||
baseCmd.AddCommand(kernels.GetCommand())
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package kernel
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/kernel/list"
|
||||
)
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "kernel COMMAND [OPTIONS]",
|
||||
Short: "Kernel Management",
|
||||
Long: "This command manages kernels available to Warewulf",
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
baseCmd.AddCommand(list.GetCommand())
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/configure"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/container"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/genconf"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/kernel"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/node"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/overlay"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/power"
|
||||
@@ -52,7 +51,6 @@ func init() {
|
||||
rootCmd.AddCommand(overlay.GetCommand())
|
||||
rootCmd.AddCommand(container.GetCommand())
|
||||
rootCmd.AddCommand(node.GetCommand())
|
||||
rootCmd.AddCommand(kernel.GetCommand())
|
||||
rootCmd.AddCommand(power.GetCommand())
|
||||
rootCmd.AddCommand(profile.GetCommand())
|
||||
rootCmd.AddCommand(configure.GetCommand())
|
||||
|
||||
@@ -8,11 +8,11 @@ provisions the kernel automatically for any node configured to use that
|
||||
container image.
|
||||
|
||||
You can see what kernels are available in imported containers by using the
|
||||
``wwctl container list`` command:
|
||||
``wwctl container kernels`` command:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# wwctl kernel list
|
||||
# wwctl container kernels
|
||||
Container Kernel Version Preferred Nodes
|
||||
--------- ------ ------- --------- -----
|
||||
newroot-test /boot/vmlinuz-5.14.0-427.37.1.el9_4.aarch64 5.14.0-427.37.1 true 0
|
||||
|
||||
Reference in New Issue
Block a user