osbuild: introduce kernel-cmdline stage

This stage can be used to set kernel boot parameters.
This commit is contained in:
Martin Sehnoutka 2020-06-08 08:27:02 +02:00 committed by Tom Gundersen
parent fcd5ff76ac
commit d20682fcae
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,19 @@
package osbuild
// KernelCmdlineStageOptions describe how to create kernel-cmdline stage
//
// Configures the kernel boot parameters, also known as the kernel command line.
type KernelCmdlineStageOptions struct {
RootFsUUID string `json:"root_fs_uuid,omitempty"`
KernelOpts string `json:"kernel_opts,omitempty"`
}
func (KernelCmdlineStageOptions) isStageOptions() {}
// NewKernelCmdlineStage creates a new kernel-cmdline Stage object.
func NewKernelCmdlineStage(options *KernelCmdlineStageOptions) *Stage {
return &Stage{
Name: "org.osbuild.kernel-cmdline",
Options: options,
}
}

View file

@ -0,0 +1,16 @@
package osbuild
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewKernelCmdlineStage(t *testing.T) {
expectedStage := &Stage{
Name: "org.osbuild.kernel-cmdline",
Options: &KernelCmdlineStageOptions{},
}
actualStage := NewKernelCmdlineStage(&KernelCmdlineStageOptions{})
assert.Equal(t, expectedStage, actualStage)
}