distro: add rhel82

This takes a different approach to outputs and customizations, which is
much shorter and duplicates less code.

This uses links to internal repositories for now, because 8.2 hasn't
been released yet.

Add a `distro` flag to `osbuild-pipeline`.
This commit is contained in:
Lars Karlitski 2019-11-27 02:53:45 +01:00 committed by Tom Gundersen
parent df74737194
commit da311f13eb
8 changed files with 726 additions and 7 deletions

View file

@ -41,7 +41,105 @@ type Group struct {
Name string `json:"name"`
}
func (b *Blueprint) GetKernelCustomization() *KernelCustomization {
// packages, modules, and groups all resolve to rpm packages right now. This
// function returns a combined list of "name-version" strings.
func (b *Blueprint) GetPackages() []string {
packages := []string{}
for _, pkg := range b.Packages {
packages = append(packages, pkg.ToNameVersion())
}
for _, pkg := range b.Modules {
packages = append(packages, pkg.ToNameVersion())
}
for _, group := range b.Groups {
packages = append(packages, group.Name)
}
return packages
}
func (b *Blueprint) GetHostname() *string {
if b.Customizations == nil {
return nil
}
return b.Customizations.Hostname
}
func (b *Blueprint) GetPrimaryLocale() (*string, *string) {
if b.Customizations == nil {
return nil, nil
}
if b.Customizations.Locale == nil {
return nil, nil
}
if len(b.Customizations.Locale.Languages) == 0 {
return nil, b.Customizations.Locale.Keyboard
}
return &b.Customizations.Locale.Languages[0], b.Customizations.Locale.Keyboard
}
func (b *Blueprint) GetTimezoneSettings() (*string, []string) {
if b.Customizations == nil {
return nil, nil
}
if b.Customizations.Timezone == nil {
return nil, nil
}
return b.Customizations.Timezone.Timezone, b.Customizations.Timezone.NTPServers
}
func (b *Blueprint) GetUsers() []UserCustomization {
if b.Customizations == nil {
return nil
}
users := []UserCustomization{}
// prepend sshkey for backwards compat (overridden by users)
if len(b.Customizations.SSHKey) > 0 {
for _, c := range b.Customizations.SSHKey {
users = append(users, UserCustomization{
Name: c.User,
Key: &c.Key,
})
}
}
return append(users, b.Customizations.User...)
}
func (b *Blueprint) GetGroups() []GroupCustomization {
if b.Customizations == nil {
return nil
}
// This is for parity with lorax, which assumes that for each
// user, a group with that name already exists. Thus, filter groups
// named like an existing user.
groups := []GroupCustomization{}
for _, group := range b.Customizations.Group {
exists := false
for _, user := range b.Customizations.User {
if user.Name == group.Name {
exists = true
break
}
}
for _, key := range b.Customizations.SSHKey {
if key.User == group.Name {
exists = true
break
}
}
if !exists {
groups = append(groups, group)
}
}
return groups
}
func (b *Blueprint) GetKernel() *KernelCustomization {
if b.Customizations == nil {
return nil
}
@ -49,7 +147,7 @@ func (b *Blueprint) GetKernelCustomization() *KernelCustomization {
return b.Customizations.Kernel
}
func (b *Blueprint) GetFirewallCustomization() *FirewallCustomization {
func (b *Blueprint) GetFirewall() *FirewallCustomization {
if b.Customizations == nil {
return nil
}
@ -57,7 +155,7 @@ func (b *Blueprint) GetFirewallCustomization() *FirewallCustomization {
return b.Customizations.Firewall
}
func (b *Blueprint) GetServicesCustomization() *ServicesCustomization {
func (b *Blueprint) GetServices() *ServicesCustomization {
if b.Customizations == nil {
return nil
}