blueprint

package
v0.0.0-...-0c11bd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package blueprint contains primitives for representing weldr blueprints

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(bp Blueprint) iblueprint.Blueprint

func DirectoryCustomizationsToFsNodeDirectories

func DirectoryCustomizationsToFsNodeDirectories(dirs []DirectoryCustomization) ([]*fsnode.Directory, error)

DirectoryCustomizationsToFsNodeDirectories converts a slice of DirectoryCustomizations to a slice of fsnode.Directories

func FileCustomizationsToFsNodeFiles

func FileCustomizationsToFsNodeFiles(files []FileCustomization) ([]*fsnode.File, error)

FileCustomizationsToFsNodeFiles converts a slice of FileCustomization to a slice of *fsnode.File

Types

type AnacondaModules

type AnacondaModules struct {
	Enable  []string `json:"enable,omitempty" toml:"enable,omitempty"`
	Disable []string `json:"disable,omitempty" toml:"disable,omitempty"`
}

type Blueprint

type Blueprint struct {
	Name           string          `json:"name" toml:"name"`
	Description    string          `json:"description" toml:"description"`
	Version        string          `json:"version,omitempty" toml:"version,omitempty"`
	Packages       []Package       `json:"packages" toml:"packages"`
	Modules        []Package       `json:"modules" toml:"modules"`
	Groups         []Group         `json:"groups" toml:"groups"`
	Containers     []Container     `json:"containers,omitempty" toml:"containers,omitempty"`
	Customizations *Customizations `json:"customizations,omitempty" toml:"customizations"`
	Distro         string          `json:"distro" toml:"distro"`
	Arch           string          `json:"architecture,omitempty" toml:"architecture,omitempty"`
}

A Blueprint is a high-level description of an image.

func (*Blueprint) BumpVersion

func (b *Blueprint) BumpVersion(old string)

BumpVersion increments the previous blueprint's version If the old version string is not vaild semver it will use the new version as-is This assumes that the new blueprint's version has already been validated via Initialize

func (*Blueprint) CryptPasswords

func (b *Blueprint) CryptPasswords() error

CryptPasswords ensures that all blueprint passwords are hashed

func (*Blueprint) DeepCopy

func (b *Blueprint) DeepCopy() Blueprint

DeepCopy returns a deep copy of the blueprint This uses json.Marshal and Unmarshal which are not very efficient

func (*Blueprint) GetPackages

func (b *Blueprint) GetPackages() []string

packages, modules, and groups all resolve to rpm packages right now. This function returns a combined list of "name-version" strings.

func (*Blueprint) GetPackagesEx

func (b *Blueprint) GetPackagesEx(bootable bool) []string

func (*Blueprint) Initialize

func (b *Blueprint) Initialize() error

Initialize ensures that the blueprint has sane defaults for any missing fields

type Change

type Change struct {
	Commit    string    `json:"commit" toml:"commit"`
	Message   string    `json:"message" toml:"message"`
	Revision  *int      `json:"revision" toml:"revision"`
	Timestamp string    `json:"timestamp" toml:"timestamp"`
	Blueprint Blueprint `json:"-" toml:"-"`
}

type Container

type Container struct {
	Source string `json:"source,omitempty" toml:"source"`
	Name   string `json:"name,omitempty" toml:"name,omitempty"`

	TLSVerify    *bool `json:"tls-verify,omitempty" toml:"tls-verify,omitempty"`
	LocalStorage bool  `json:"local-storage,omitempty" toml:"local-storage,omitempty"`
}

type CustomizationError

type CustomizationError struct {
	Message string
}

func (*CustomizationError) Error

func (e *CustomizationError) Error() string

type Customizations

type Customizations struct {
	Hostname           *string                   `json:"hostname,omitempty" toml:"hostname,omitempty"`
	Kernel             *KernelCustomization      `json:"kernel,omitempty" toml:"kernel,omitempty"`
	SSHKey             []SSHKeyCustomization     `json:"sshkey,omitempty" toml:"sshkey,omitempty"`
	User               []UserCustomization       `json:"user,omitempty" toml:"user,omitempty"`
	Group              []GroupCustomization      `json:"group,omitempty" toml:"group,omitempty"`
	Timezone           *TimezoneCustomization    `json:"timezone,omitempty" toml:"timezone,omitempty"`
	Locale             *LocaleCustomization      `json:"locale,omitempty" toml:"locale,omitempty"`
	Firewall           *FirewallCustomization    `json:"firewall,omitempty" toml:"firewall,omitempty"`
	Services           *ServicesCustomization    `json:"services,omitempty" toml:"services,omitempty"`
	Filesystem         []FilesystemCustomization `json:"filesystem,omitempty" toml:"filesystem,omitempty"`
	InstallationDevice string                    `json:"installation_device,omitempty" toml:"installation_device,omitempty"`
	PartitioningMode   string                    `json:"partitioning_mode,omitempty" toml:"partitioning_mode,omitempty"`
	FDO                *FDOCustomization         `json:"fdo,omitempty" toml:"fdo,omitempty"`
	OpenSCAP           *OpenSCAPCustomization    `json:"openscap,omitempty" toml:"openscap,omitempty"`
	Ignition           *IgnitionCustomization    `json:"ignition,omitempty" toml:"ignition,omitempty"`
	Directories        []DirectoryCustomization  `json:"directories,omitempty" toml:"directories,omitempty"`
	Files              []FileCustomization       `json:"files,omitempty" toml:"files,omitempty"`
	Repositories       []RepositoryCustomization `json:"repositories,omitempty" toml:"repositories,omitempty"`
	FIPS               *bool                     `json:"fips,omitempty" toml:"fips,omitempty"`
	Installer          *InstallerCustomization   `json:"installer,omitempty" toml:"installer,omitempty"`
	RPM                *RPMCustomization         `json:"rpm,omitempty" toml:"rpm,omitempty"`
	RHSM               *RHSMCustomization        `json:"rhsm,omitempty" toml:"rhsm,omitempty"`
}

func (*Customizations) CheckAllowed

func (c *Customizations) CheckAllowed(allowed ...string) error

CheckCustomizations returns an error of type `CustomizationError` if `c` has any customizations not specified in `allowed`

func (*Customizations) GetDirectories

func (c *Customizations) GetDirectories() []DirectoryCustomization

func (*Customizations) GetFDO

func (c *Customizations) GetFDO() *FDOCustomization

func (*Customizations) GetFIPS

func (c *Customizations) GetFIPS() bool

func (*Customizations) GetFiles

func (c *Customizations) GetFiles() []FileCustomization

func (*Customizations) GetFilesystems

func (c *Customizations) GetFilesystems() []FilesystemCustomization

func (*Customizations) GetFilesystemsMinSize

func (c *Customizations) GetFilesystemsMinSize() uint64

func (*Customizations) GetFirewall

func (c *Customizations) GetFirewall() *FirewallCustomization

func (*Customizations) GetGroups

func (c *Customizations) GetGroups() []GroupCustomization

func (*Customizations) GetHostname

func (c *Customizations) GetHostname() *string

func (*Customizations) GetIgnition

func (c *Customizations) GetIgnition() *IgnitionCustomization

func (*Customizations) GetInstallationDevice

func (c *Customizations) GetInstallationDevice() string

func (*Customizations) GetKernel

func (c *Customizations) GetKernel() *KernelCustomization

func (*Customizations) GetOpenSCAP

func (c *Customizations) GetOpenSCAP() *OpenSCAPCustomization

func (*Customizations) GetPartitioningMode

func (c *Customizations) GetPartitioningMode() (disk.PartitioningMode, error)

GetPartitioningMode converts the string to a disk.PartitioningMode type

func (*Customizations) GetPrimaryLocale

func (c *Customizations) GetPrimaryLocale() (*string, *string)

func (*Customizations) GetRepositories

func (c *Customizations) GetRepositories() ([]RepositoryCustomization, error)

func (*Customizations) GetServices

func (c *Customizations) GetServices() *ServicesCustomization

func (*Customizations) GetTimezoneSettings

func (c *Customizations) GetTimezoneSettings() (*string, []string)

func (*Customizations) GetUsers

func (c *Customizations) GetUsers() []UserCustomization

type DNFPluginConfig

type DNFPluginConfig struct {
	Enabled *bool `json:"enabled,omitempty" toml:"enabled,omitempty"`
}

type DirectoryCustomization

type DirectoryCustomization struct {
	// Absolute path to the directory
	Path string `json:"path" toml:"path"`
	// Owner of the directory specified as a string (user name), int64 (UID) or nil
	User interface{} `json:"user,omitempty" toml:"user,omitempty"`
	// Owner of the directory specified as a string (group name), int64 (UID) or nil
	Group interface{} `json:"group,omitempty" toml:"group,omitempty"`
	// Permissions of the directory specified as an octal number
	Mode string `json:"mode,omitempty" toml:"mode,omitempty"`
	// EnsureParents ensures that all parent directories of the directory exist
	EnsureParents bool `json:"ensure_parents,omitempty" toml:"ensure_parents,omitempty"`
}

DirectoryCustomization represents a directory to be created in the image

func (DirectoryCustomization) ToFsNodeDirectory

func (d DirectoryCustomization) ToFsNodeDirectory() (*fsnode.Directory, error)

ToFsNodeDirectory converts the DirectoryCustomization to an fsnode.Directory

func (*DirectoryCustomization) UnmarshalJSON

func (d *DirectoryCustomization) UnmarshalJSON(data []byte) error

Custom JSON unmarshalling for DirectoryCustomization with validation

func (*DirectoryCustomization) UnmarshalTOML

func (d *DirectoryCustomization) UnmarshalTOML(data interface{}) error

Custom TOML unmarshalling for DirectoryCustomization with validation

type EmbeddedIgnitionCustomization

type EmbeddedIgnitionCustomization struct {
	Config string `json:"config,omitempty" toml:"config,omitempty"`
}

type FDOCustomization

type FDOCustomization struct {
	ManufacturingServerURL string `json:"manufacturing_server_url,omitempty" toml:"manufacturing_server_url,omitempty"`
	DiunPubKeyInsecure     string `json:"diun_pub_key_insecure,omitempty" toml:"diun_pub_key_insecure,omitempty"`
	// This is the output of:
	// echo "sha256:$(openssl x509 -fingerprint -sha256 -noout -in diun_cert.pem | cut -d"=" -f2 | sed 's/://g')"
	DiunPubKeyHash          string `json:"diun_pub_key_hash,omitempty" toml:"diun_pub_key_hash,omitempty"`
	DiunPubKeyRootCerts     string `json:"diun_pub_key_root_certs,omitempty" toml:"diun_pub_key_root_certs,omitempty"`
	DiMfgStringTypeMacIface string `json:"di_mfg_string_type_mac_iface,omitempty" toml:"di_mfg_string_type_mac_iface,omitempty"`
}

type FileCustomization

type FileCustomization struct {
	// Absolute path to the file
	Path string `json:"path" toml:"path"`
	// Owner of the directory specified as a string (user name), int64 (UID) or nil
	User interface{} `json:"user,omitempty" toml:"user,omitempty"`
	// Owner of the directory specified as a string (group name), int64 (UID) or nil
	Group interface{} `json:"group,omitempty" toml:"group,omitempty"`
	// Permissions of the file specified as an octal number
	Mode string `json:"mode,omitempty" toml:"mode,omitempty"`
	// Data is the file content in plain text
	Data string `json:"data,omitempty" toml:"data,omitempty"`
}

FileCustomization represents a file to be created in the image

func (FileCustomization) ToFsNodeFile

func (f FileCustomization) ToFsNodeFile() (*fsnode.File, error)

ToFsNodeFile converts the FileCustomization to an fsnode.File

func (*FileCustomization) UnmarshalJSON

func (f *FileCustomization) UnmarshalJSON(data []byte) error

Custom JSON unmarshalling for FileCustomization with validation

func (*FileCustomization) UnmarshalTOML

func (f *FileCustomization) UnmarshalTOML(data interface{}) error

Custom TOML unmarshalling for FileCustomization with validation

type FilesystemCustomization

type FilesystemCustomization struct {
	Mountpoint string `json:"mountpoint,omitempty" toml:"mountpoint,omitempty"`
	MinSize    uint64 `json:"minsize,omitempty" toml:"minsize,omitempty"`
}

func (*FilesystemCustomization) UnmarshalJSON

func (fsc *FilesystemCustomization) UnmarshalJSON(data []byte) error

func (*FilesystemCustomization) UnmarshalTOML

func (fsc *FilesystemCustomization) UnmarshalTOML(data interface{}) error

type FirewallCustomization

type FirewallCustomization struct {
	Ports    []string                       `json:"ports,omitempty" toml:"ports,omitempty"`
	Services *FirewallServicesCustomization `json:"services,omitempty" toml:"services,omitempty"`
	Zones    []FirewallZoneCustomization    `json:"zones,omitempty" toml:"zones,omitempty"`
}

type FirewallServicesCustomization

type FirewallServicesCustomization struct {
	Enabled  []string `json:"enabled,omitempty" toml:"enabled,omitempty"`
	Disabled []string `json:"disabled,omitempty" toml:"disabled,omitempty"`
}

type FirewallZoneCustomization

type FirewallZoneCustomization struct {
	Name    *string  `json:"name,omitempty" toml:"name,omitempty"`
	Sources []string `json:"sources,omitempty" toml:"sources,omitempty"`
}

type FirstBootIgnitionCustomization

type FirstBootIgnitionCustomization struct {
	ProvisioningURL string `json:"url,omitempty" toml:"url,omitempty"`
}

type Group

type Group struct {
	Name string `json:"name" toml:"name"`
}

A group specifies an package group.

type GroupCustomization

type GroupCustomization struct {
	Name string `json:"name" toml:"name"`
	GID  *int   `json:"gid,omitempty" toml:"gid,omitempty"`
}

type IgnitionCustomization

type IgnitionCustomization struct {
	Embedded  *EmbeddedIgnitionCustomization  `json:"embedded,omitempty" toml:"embedded,omitempty"`
	FirstBoot *FirstBootIgnitionCustomization `json:"firstboot,omitempty" toml:"firstboot,omitempty"`
}

type InstallerCustomization

type InstallerCustomization struct {
	Unattended   bool             `json:"unattended,omitempty" toml:"unattended,omitempty"`
	SudoNopasswd []string         `json:"sudo-nopasswd,omitempty" toml:"sudo-nopasswd,omitempty"`
	Kickstart    *Kickstart       `json:"kickstart,omitempty" toml:"kickstart,omitempty"`
	Modules      *AnacondaModules `json:"modules,omitempty" toml:"modules,omitempty"`
}

type KernelCustomization

type KernelCustomization struct {
	Name   string `json:"name,omitempty" toml:"name,omitempty"`
	Append string `json:"append" toml:"append"`
}

type Kickstart

type Kickstart struct {
	Contents string `json:"contents" toml:"contents"`
}

type LocaleCustomization

type LocaleCustomization struct {
	Languages []string `json:"languages,omitempty" toml:"languages,omitempty"`
	Keyboard  *string  `json:"keyboard,omitempty" toml:"keyboard,omitempty"`
}

type OpenSCAPCustomization

type OpenSCAPCustomization struct {
	DataStream    string                               `json:"datastream,omitempty" toml:"datastream,omitempty"`
	ProfileID     string                               `json:"profile_id,omitempty" toml:"profile_id,omitempty"`
	Tailoring     *OpenSCAPTailoringCustomizations     `json:"tailoring,omitempty" toml:"tailoring,omitempty"`
	JSONTailoring *OpenSCAPJSONTailoringCustomizations `json:"json_tailoring,omitempty" toml:"json_tailoring,omitempty"`
	PolicyID      string                               `json:"policy_id,omitempty" toml:"policy_id,omitempty"`
}

type OpenSCAPJSONTailoringCustomizations

type OpenSCAPJSONTailoringCustomizations struct {
	ProfileID string `json:"profile_id,omitempty" toml:"profile_id,omitempty"`
	Filepath  string `json:"filepath,omitempty" toml:"filepath,omitempty"`
}

type OpenSCAPTailoringCustomizations

type OpenSCAPTailoringCustomizations struct {
	Selected   []string `json:"selected,omitempty" toml:"selected,omitempty"`
	Unselected []string `json:"unselected,omitempty" toml:"unselected,omitempty"`
}

type Package

type Package struct {
	Name    string `json:"name" toml:"name"`
	Version string `json:"version,omitempty" toml:"version,omitempty"`
}

A Package specifies an RPM package.

func (Package) ToNameVersion

func (p Package) ToNameVersion() string

type RHSMConfig

type RHSMConfig struct {
	DNFPlugins          *SubManDNFPluginsConfig `json:"dnf_plugins,omitempty" toml:"dnf_plugins,omitempty"`
	SubscriptionManager *SubManConfig           `json:"subscription_manager,omitempty" toml:"subscription_manager,omitempty"`
}

type RHSMCustomization

type RHSMCustomization struct {
	Config *RHSMConfig `json:"config,omitempty" toml:"config,omitempty"`
}

type RPMCustomization

type RPMCustomization struct {
	ImportKeys *RPMImportKeys `json:"import_keys,omitempty" toml:"import_keys,omitempty"`
}

type RPMImportKeys

type RPMImportKeys struct {
	// File paths in the image to import keys from
	Files []string `json:"files,omitempty" toml:"files,omitempty"`
}

type RepositoryCustomization

type RepositoryCustomization struct {
	Id             string   `json:"id" toml:"id"`
	BaseURLs       []string `json:"baseurls,omitempty" toml:"baseurls,omitempty"`
	GPGKeys        []string `json:"gpgkeys,omitempty" toml:"gpgkeys,omitempty"`
	Metalink       string   `json:"metalink,omitempty" toml:"metalink,omitempty"`
	Mirrorlist     string   `json:"mirrorlist,omitempty" toml:"mirrorlist,omitempty"`
	Name           string   `json:"name,omitempty" toml:"name,omitempty"`
	Priority       *int     `json:"priority,omitempty" toml:"priority,omitempty"`
	Enabled        *bool    `json:"enabled,omitempty" toml:"enabled,omitempty"`
	GPGCheck       *bool    `json:"gpgcheck,omitempty" toml:"gpgcheck,omitempty"`
	RepoGPGCheck   *bool    `json:"repo_gpgcheck,omitempty" toml:"repo_gpgcheck,omitempty"`
	SSLVerify      *bool    `json:"sslverify,omitempty" toml:"sslverify,omitempty"`
	ModuleHotfixes *bool    `json:"module_hotfixes,omitempty" toml:"module_hotfixes,omitempty"`
	Filename       string   `json:"filename,omitempty" toml:"filename,omitempty"`
}

type SSHKeyCustomization

type SSHKeyCustomization struct {
	User string `json:"user" toml:"user"`
	Key  string `json:"key" toml:"key"`
}

type ServicesCustomization

type ServicesCustomization struct {
	Enabled  []string `json:"enabled,omitempty" toml:"enabled,omitempty"`
	Disabled []string `json:"disabled,omitempty" toml:"disabled,omitempty"`
	Masked   []string `json:"masked,omitempty" toml:"masked,omitempty"`
}

type SubManConfig

type SubManConfig struct {
	RHSMConfig      *SubManRHSMConfig      `json:"rhsm,omitempty" toml:"rhsm,omitempty"`
	RHSMCertdConfig *SubManRHSMCertdConfig `json:"rhsmcertd,omitempty" toml:"rhsmcertd,omitempty"`
}

Subscription Manager 'rhsm.conf' configuration

type SubManDNFPluginsConfig

type SubManDNFPluginsConfig struct {
	ProductID           *DNFPluginConfig `json:"product_id,omitempty" toml:"product_id,omitempty"`
	SubscriptionManager *DNFPluginConfig `json:"subscription_manager,omitempty" toml:"subscription_manager,omitempty"`
}

type SubManRHSMCertdConfig

type SubManRHSMCertdConfig struct {
	AutoRegistration *bool `json:"auto_registration,omitempty" toml:"auto_registration,omitempty"`
}

Subscription Manager [rhsmcertd] configuration

type SubManRHSMConfig

type SubManRHSMConfig struct {
	ManageRepos *bool `json:"manage_repos,omitempty" toml:"manage_repos,omitempty"`
}

Subscription Manager [rhsm] configuration

type TimezoneCustomization

type TimezoneCustomization struct {
	Timezone   *string  `json:"timezone,omitempty" toml:"timezone,omitempty"`
	NTPServers []string `json:"ntpservers,omitempty" toml:"ntpservers,omitempty"`
}

type UserCustomization

type UserCustomization struct {
	Name               string   `json:"name" toml:"name"`
	Description        *string  `json:"description,omitempty" toml:"description,omitempty"`
	Password           *string  `json:"password,omitempty" toml:"password,omitempty"`
	Key                *string  `json:"key,omitempty" toml:"key,omitempty"`
	Home               *string  `json:"home,omitempty" toml:"home,omitempty"`
	Shell              *string  `json:"shell,omitempty" toml:"shell,omitempty"`
	Groups             []string `json:"groups,omitempty" toml:"groups,omitempty"`
	UID                *int     `json:"uid,omitempty" toml:"uid,omitempty"`
	GID                *int     `json:"gid,omitempty" toml:"gid,omitempty"`
	ExpireDate         *int     `json:"expiredate,omitempty" toml:"expiredate,omitempty"`
	ForcePasswordReset *bool    `json:"force_password_reset,omitempty" toml:"force_password_reset,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL