debian-forge-composer/internal/blueprint/customizations.go
Lars Karlitski b33ed9e5d2 blueprint: move pipeline generation into its own package
Introduce the `distro` package, which contains an interface for OS
implementations. Its main purpose is to convert a blueprint to a
distro-specific pipeline.

Also introduce the `distro/fedora30` package. It is the first
implementation of the distro interface. Most of its code has been copied
with minimal modifications from the blueprint package.

The `blueprint` package is now back to serving a single purpose:
representing a weldr blueprint. It does not depend on the `pipeline`
package anymore.

Change osbuild-composer and osbuild-pipeline to use the new API,
hard-coding "fedora-30". This looks a bit weird now, but is the same
behavior as before.

All test cases now also take an "distro" key in the "compose" object.
2019-11-07 17:13:20 +01:00

72 lines
2.1 KiB
Go

package blueprint
type Customizations struct {
Hostname *string `json:"hostname,omitempty"`
Kernel *KernelCustomization `json:"kernel,omitempty"`
SSHKey []SSHKeyCustomization `json:"sshkey,omitempty"`
User []UserCustomization `json:"user,omitempty"`
Group []GroupCustomization `json:"group,omitempty"`
Timezone *TimezoneCustomization `json:"timezone,omitempty"`
Locale *LocaleCustomization `json:"locale,omitempty"`
Firewall *FirewallCustomization `json:"firewall,omitempty"`
Services *ServicesCustomization `json:"services,omitempty"`
}
type KernelCustomization struct {
Append string `json:"append"`
}
type SSHKeyCustomization struct {
User string `json:"user"`
Key string `json:"key"`
}
type UserCustomization struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Password *string `json:"password,omitempty"`
Key *string `json:"key,omitempty"`
Home *string `json:"home,omitempty"`
Shell *string `json:"shell,omitempty"`
Groups []string `json:"groups,omitempty"`
UID *int `json:"uid,omitempty"`
GID *int `json:"gid,omitempty"`
}
type GroupCustomization struct {
Name string `json:"name"`
GID *int `json:"gid,omitempty"`
}
type TimezoneCustomization struct {
Timezone *string `json:"timezone,omitempty"`
NTPServers []string `json:"ntpservers,omitempty"`
}
type LocaleCustomization struct {
Languages []string `json:"languages,omitempty"`
Keyboard *string `json:"keyboard,omitempty"`
}
type FirewallCustomization struct {
Ports []string `json:"ports,omitempty"`
Services *FirewallServicesCustomization `json:"services,omitempty"`
}
type FirewallServicesCustomization struct {
Enabled []string `json:"enabled,omitempty"`
Disabled []string `json:"disabled,omitempty"`
}
type ServicesCustomization struct {
Enabled []string `json:"enabled,omitempty"`
Disabled []string `json:"disabled,omitempty"`
}
type CustomizationError struct {
Message string
}
func (e *CustomizationError) Error() string {
return e.Message
}