Rename "preferred" kernel to "default" kernel
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
6f4d33b19e
commit
facba28e0f
@@ -40,18 +40,18 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
t := table.New(cmd.OutOrStdout())
|
||||
t.AddHeader("Container", "Kernel", "Version", "Preferred", "Nodes")
|
||||
t.AddHeader("Container", "Kernel", "Version", "Default", "Nodes")
|
||||
for _, source := range sources {
|
||||
containerKernels := kernel.FindKernels(source)
|
||||
preferredKernel := containerKernels.Preferred()
|
||||
defaultKernel := containerKernels.Default()
|
||||
for _, kernel_ := range containerKernels {
|
||||
preferred := preferredKernel != nil && preferredKernel == kernel_
|
||||
preferredStr := strconv.FormatBool(preferred)
|
||||
isDefault := defaultKernel != nil && defaultKernel == kernel_
|
||||
defaultStr := strconv.FormatBool(isDefault)
|
||||
nodeCount := kernelNodes[*kernel_]
|
||||
if preferred {
|
||||
if isDefault {
|
||||
nodeCount = nodeCount + kernelNodes[kernel.Kernel{ContainerName: source, Path: ""}]
|
||||
}
|
||||
t.AddLine(table.Prep([]string{source, kernel_.Path, kernel_.Version(), preferredStr, strconv.Itoa(nodeCount)})...)
|
||||
t.AddLine(table.Prep([]string{source, kernel_.Path, kernel_.Version(), defaultStr, strconv.Itoa(nodeCount)})...)
|
||||
}
|
||||
}
|
||||
t.Print()
|
||||
|
||||
@@ -21,8 +21,8 @@ func Test_List(t *testing.T) {
|
||||
files: map[string][]string{},
|
||||
args: []string{},
|
||||
stdout: `
|
||||
Container Kernel Version Preferred Nodes
|
||||
--------- ------ ------- --------- -----
|
||||
Container Kernel Version Default Nodes
|
||||
--------- ------ ------- ------- -----
|
||||
`,
|
||||
},
|
||||
"list": {
|
||||
@@ -42,16 +42,16 @@ Container Kernel Version Preferred Nodes
|
||||
},
|
||||
args: []string{},
|
||||
stdout: `
|
||||
Container Kernel Version Preferred Nodes
|
||||
--------- ------ ------- --------- -----
|
||||
container1 /boot/vmlinuz-4.14.0-427.18.1.el8_4.x86_64 4.14.0-427.18.1 false 0
|
||||
container1 /boot/vmlinuz-5.14.0-427.18.1.el9_4.x86_64 5.14.0-427.18.1 false 0
|
||||
container1 /boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64 5.14.0-427.24.1 true 0
|
||||
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
|
||||
Container Kernel Version Default Nodes
|
||||
--------- ------ ------- ------- -----
|
||||
container1 /boot/vmlinuz-4.14.0-427.18.1.el8_4.x86_64 4.14.0-427.18.1 false 0
|
||||
container1 /boot/vmlinuz-5.14.0-427.18.1.el9_4.x86_64 5.14.0-427.18.1 false 0
|
||||
container1 /boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64 5.14.0-427.24.1 true 0
|
||||
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
|
||||
`,
|
||||
},
|
||||
"single container": {
|
||||
@@ -71,13 +71,13 @@ container2 /boot/vmlinuz-5.14.0-427.31.1.el9_4.aarch64+debug 5.14.0-427.
|
||||
},
|
||||
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
|
||||
Container Kernel Version Default 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
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user