rhel84/grub2: set saved_entry
Explicitly set the kernel to boot into. Also change the blueprint/kernenl handling: Rather than only falling back to the default kernel name for getting the package list, let GetKernel() always return the correct result so we can rely on this being consistent. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
e4b9453d40
commit
0efc345b2d
8 changed files with 45 additions and 29 deletions
|
|
@ -104,13 +104,10 @@ func (b *Blueprint) GetPackages() []string {
|
|||
packages = append(packages, "@"+group.Name)
|
||||
}
|
||||
|
||||
if kc := b.Customizations.GetKernel(); kc != nil && kc.Name != "" {
|
||||
kpkg := Package{Name: b.Customizations.Kernel.Name}
|
||||
packages = append(packages, kpkg.ToNameVersion())
|
||||
} else { // no Kernel specified; add default
|
||||
kpkg := Package{Name: "kernel"}
|
||||
packages = append(packages, kpkg.ToNameVersion())
|
||||
}
|
||||
kc := b.Customizations.GetKernel()
|
||||
kpkg := Package{Name: kc.Name}
|
||||
packages = append(packages, kpkg.ToNameVersion())
|
||||
|
||||
return packages
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,11 +155,21 @@ func (c *Customizations) GetGroups() []GroupCustomization {
|
|||
}
|
||||
|
||||
func (c *Customizations) GetKernel() *KernelCustomization {
|
||||
if c == nil {
|
||||
return nil
|
||||
var name string
|
||||
var append string
|
||||
if c != nil && c.Kernel != nil {
|
||||
name = c.Kernel.Name
|
||||
append = c.Kernel.Append
|
||||
}
|
||||
|
||||
return c.Kernel
|
||||
if name == "" {
|
||||
name = "kernel"
|
||||
}
|
||||
|
||||
return &KernelCustomization{
|
||||
Name: name,
|
||||
Append: append,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Customizations) GetFirewall() *FirewallCustomization {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package blueprint
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetHostname(t *testing.T) {
|
||||
|
|
@ -22,6 +23,7 @@ func TestGetKernel(t *testing.T) {
|
|||
|
||||
expectedKernel := KernelCustomization{
|
||||
Append: "--test",
|
||||
Name: "kernel",
|
||||
}
|
||||
|
||||
TestCustomizations := Customizations{
|
||||
|
|
@ -214,7 +216,7 @@ func TestNoCustomizationsInBlueprint(t *testing.T) {
|
|||
assert.Nil(t, TestBP.Customizations.GetHostname())
|
||||
assert.Nil(t, TestBP.Customizations.GetUsers())
|
||||
assert.Nil(t, TestBP.Customizations.GetGroups())
|
||||
assert.Nil(t, TestBP.Customizations.GetKernel())
|
||||
assert.Equal(t, &KernelCustomization{Name: "kernel"}, TestBP.Customizations.GetKernel())
|
||||
assert.Nil(t, TestBP.Customizations.GetFirewall())
|
||||
assert.Nil(t, TestBP.Customizations.GetServices())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue