RHEL-90: introduce default image config data structure
Introduce a new data structure `ImageConfig` holding the default OS configuration applied when building an image. The structure can be used to hold the default image configuration on the distribution level with possible overrides defined on the image-type level. As a starting point, move hard-coded default values and configuration common for `osPipeline`, `ec2BaseTreePipeline` and `ostreeTreePipeline` to the distribution and image-type default image configuration. This is preparing the ground for merging all of these three pipeline functions into `osPipeline`, which will produce the appropriate OS pipeline based on the image-type configuration and the fact if it is rpmOstree or not. Regenerate affected EC2 and AMI manifests. There is however no change in the resulting image configuration and image-info report. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
3c729be3c5
commit
b200fa8fcd
10 changed files with 526 additions and 243 deletions
48
internal/distro/image_config.go
Normal file
48
internal/distro/image_config.go
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package distro
|
||||
|
||||
import "github.com/osbuild/osbuild-composer/internal/osbuild2"
|
||||
|
||||
// ImageConfig represents a (default) configuration applied to the image
|
||||
type ImageConfig struct {
|
||||
Timezone string
|
||||
TimeSynchronization *osbuild2.ChronyStageOptions
|
||||
Locale string
|
||||
Keyboard *osbuild2.KeymapStageOptions
|
||||
EnabledServices []string
|
||||
DisabledServices []string
|
||||
DefaultTarget string
|
||||
Sysconfig []*osbuild2.SysconfigStageOptions
|
||||
}
|
||||
|
||||
// InheritFrom inherits unset values from the provided parent configuration and
|
||||
// returns a new structure instance, which is a result of the inheritance.
|
||||
func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig {
|
||||
finalConfig := ImageConfig(*c)
|
||||
if parentConfig != nil {
|
||||
if finalConfig.Timezone == "" {
|
||||
finalConfig.Timezone = parentConfig.Timezone
|
||||
}
|
||||
if finalConfig.TimeSynchronization == nil {
|
||||
finalConfig.TimeSynchronization = parentConfig.TimeSynchronization
|
||||
}
|
||||
if finalConfig.Locale == "" {
|
||||
finalConfig.Locale = parentConfig.Locale
|
||||
}
|
||||
if finalConfig.Keyboard == nil {
|
||||
finalConfig.Keyboard = parentConfig.Keyboard
|
||||
}
|
||||
if finalConfig.EnabledServices == nil {
|
||||
finalConfig.EnabledServices = parentConfig.EnabledServices
|
||||
}
|
||||
if finalConfig.DisabledServices == nil {
|
||||
finalConfig.DisabledServices = parentConfig.DisabledServices
|
||||
}
|
||||
if finalConfig.DefaultTarget == "" {
|
||||
finalConfig.DefaultTarget = parentConfig.DefaultTarget
|
||||
}
|
||||
if finalConfig.Sysconfig == nil {
|
||||
finalConfig.Sysconfig = parentConfig.Sysconfig
|
||||
}
|
||||
}
|
||||
return &finalConfig
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue