plugins

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: Apache-2.0 Imports: 61 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ErrorEmptyOverrideService = "Skipping empty override service"
	ErrorEmptyOverrideContent = "Empty override content for %s"
	DefaultOverrideName       = "override-yip.conf"
	DefaultOverrideDir        = "/etc/systemd/system/%s.d"
	DefaultServiceExt         = ".service"
	DefaultOverrideExt        = ".conf"
	EmptyString               = ""
)
View Source
const RunOnlyOs = "running stage (OnlyIfOs regex (%s)"
View Source
const RunOnlyOsVersion = "running stage (OnlyIfOsVersion regex (%s)"
View Source
const SkipBothServices = "both systemd and openrc are available, cant filter"
View Source
const SkipNotSupportedServiceManager = "service manager %s is not supported"
View Source
const SkipOnlyArch = "arch %s doesn't match %s"
View Source
const SkipOnlyOs = "OnlyIfOs regex (%s)"
View Source
const SkipOnlyOsVersion = "OnlyIfOsVersion regex (%s)"
View Source
const SkipOnlyServiceManager = "service manager doesn't match %s"

Variables

This section is empty.

Functions

func Build added in v1.9.4

func Build(path string, nameservers, dnsSearch, dnsOptions []string) error

func Commands

func Commands(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func DNS

func DNS(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func DataSources

func DataSources(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func DecodeMultipartVmware added in v1.3.1

func DecodeMultipartVmware(data []byte) []byte

DecodeMultipartVmware will try to decode the user-data from VMWARE provider as it returns a multipart/mixed data instead of the simple cloud-config

func DeleteEntities

func DeleteEntities(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Download

func Download(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func EnsureDirectories

func EnsureDirectories(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func EnsureFiles

func EnsureFiles(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Entities

func Entities(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Environment

func Environment(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Git

func Git(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Hostname

func Hostname(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func IfArch added in v1.14.1

func IfArch(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

IfArch checks if the current architecture matches the one specified in the stage Only runs if the regex matches the current architecture

func IfConditional

func IfConditional(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func IfFiles added in v1.18.0

func IfFiles(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func IfServiceManager added in v1.14.1

func IfServiceManager(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

IfServiceManager checks if the current service manager matches the one specified in the stage Only runs if the service manager matches the specified service manager

func Layout

func Layout(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func LoadModules

func LoadModules(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func MatchPartitionFSLabel

func MatchPartitionFSLabel(l logger.Interface, label string, console Console) string

func MatchPartitionPLabel

func MatchPartitionPLabel(l logger.Interface, label string, console Console) string

func MiBToSectors

func MiBToSectors(size uint, sectorSize uint) uint

func NodeConditional

func NodeConditional(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func OnlyIfOS added in v1.14.0

func OnlyIfOS(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

OnlyIfOS checks if the OS matches the if statement and runs it if so

func OnlyIfOSVersion added in v1.14.0

func OnlyIfOSVersion(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

OnlyIfOSVersion checks if the OS VERSION matches the if statement and runs it if so

func Packages added in v1.13.0

func Packages(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

Packages runs the package manager to try to install/remove/upgrade/refresh packages It will try to identify the package manager based on the distro If it can't identify the package manager, it will return an error Order is Refresh -> Upgrade -> Install -> Remove

func SSH

func SSH(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Sysctl

func Sysctl(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func SystemHostname

func SystemHostname(hostname string, fs vfs.FS) error

func Systemctl

func Systemctl(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func SystemdFirstboot

func SystemdFirstboot(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func Timesyncd

func Timesyncd(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func UnpackImage added in v1.14.0

func UnpackImage(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

func UpdateHostsFile

func UpdateHostsFile(hostname string, fs vfs.FS) error

func User

func User(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error

Types

type Console

type Console interface {
	Run(string, ...func(*exec.Cmd)) (string, error)
	Start(*exec.Cmd, ...func(*exec.Cmd)) error
	RunTemplate([]string, string) error
}

type Disk

type Disk struct {
	Device  string
	SectorS uint
	LastS   uint
	Parts   []Partition
}

func FindDiskFromPartitionLabel

func FindDiskFromPartitionLabel(l logger.Interface, label string, console Console) (Disk, error)

func FindDiskFromPath

func FindDiskFromPath(path string, console Console) (Disk, error)

func (*Disk) AddPartition

func (dev *Disk) AddPartition(l logger.Interface, label string, size uint, fileSystem string, pLabel string, console Console) (string, error)

Size is expressed in MiB here

func (*Disk) CheckDiskFreeSpaceMiB

func (dev *Disk) CheckDiskFreeSpaceMiB(l logger.Interface, minSpace uint, console Console) bool

Size is expressed in MiB here

func (*Disk) ExpandLastPartition

func (dev *Disk) ExpandLastPartition(l logger.Interface, size uint, console Console) (string, error)

ExpandLastPartition will call growpart + resize tool in a given partition to grow it up to max space available

func (Disk) FindPartitionDevice

func (dev Disk) FindPartitionDevice(l logger.Interface, partNum int, console Console) (string, error)

func (*Disk) GetFreeSpace

func (dev *Disk) GetFreeSpace(l logger.Interface, console Console) (uint, error)

func (*Disk) Reload

func (dev *Disk) Reload(console Console) error

func (Disk) ReloadPartitionTable

func (dev Disk) ReloadPartitionTable(l logger.Interface, console Console) error

func (Disk) String

func (dev Disk) String() string

type Distro added in v1.13.0

type Distro string
const (
	Debian             Distro = "debian"
	Ubuntu             Distro = "ubuntu"
	RedHat             Distro = "rhel"
	CentOS             Distro = "centos"
	RockyLinux         Distro = "rocky"
	AlmaLinux          Distro = "almalinux"
	Fedora             Distro = "fedora"
	Arch               Distro = "arch"
	Alpine             Distro = "alpine"
	OpenSUSELeap       Distro = "opensuse-leap"
	OpenSUSETumbleweed Distro = "opensuse-tumbleweed"
	SUSE               Distro = "suse"
)

type GdiskCall

type GdiskCall struct {
	// contains filtered or unexported fields
}

func NewGdiskCall

func NewGdiskCall(dev string) *GdiskCall

func (*GdiskCall) CreatePartition

func (gd *GdiskCall) CreatePartition(p *Partition)

func (*GdiskCall) DeletePartition

func (gd *GdiskCall) DeletePartition(num int)

func (*GdiskCall) ExpandPTable

func (gd *GdiskCall) ExpandPTable()

func (GdiskCall) GetLastSector

func (gd GdiskCall) GetLastSector(printOut string) (uint, error)

Parses the output of a GdiskCall.Print call

func (GdiskCall) GetPartitionData

func (gd GdiskCall) GetPartitionData(partNum int, console Console) (*Partition, error)

func (GdiskCall) GetPartitions

func (gd GdiskCall) GetPartitions(printOut string) []Partition

Parses the output of a GdiskCall.Print call

func (GdiskCall) GetSectorSize

func (gd GdiskCall) GetSectorSize(printOut string) (uint, error)

Parses the output of a GdiskCall.Print call There was a change in the output of sgdisk in version 1.0.2 https://www.rodsbooks.com/gdisk/revisions.html We are trying to match both possible outputs

func (GdiskCall) HasUnallocatedSpace

func (gd GdiskCall) HasUnallocatedSpace(console Console) bool

func (GdiskCall) Info

func (gd GdiskCall) Info(partNum int, console Console) (string, error)

func (GdiskCall) Print

func (gd GdiskCall) Print(console Console) (string, error)

func (*GdiskCall) SetPretend

func (gd *GdiskCall) SetPretend(pretend bool)

func (GdiskCall) Verify

func (gd GdiskCall) Verify(console Console) (string, error)

func (*GdiskCall) WipeTable

func (gd *GdiskCall) WipeTable(wipe bool)

func (*GdiskCall) WriteChanges

func (gd *GdiskCall) WriteChanges(console Console) (string, error)

type Installer added in v1.13.0

type Installer string
const (
	APTInstaller     Installer = "apt-get"
	DNFInstaller     Installer = "dnf"
	PacmanInstaller  Installer = "pacman"
	SUSEInstaller    Installer = "zypper"
	AlpineInstaller  Installer = "apk"
	UnknownInstaller Installer = "unknown"
)

func (Installer) String added in v1.13.0

func (d Installer) String() string

type MkfsCall

type MkfsCall struct {
	// contains filtered or unexported fields
}

func (MkfsCall) Apply

func (mkfs MkfsCall) Apply(console Console) (string, error)

type Partition

type Partition struct {
	Number     int
	StartS     uint
	SizeS      uint
	PLabel     string
	FileSystem string
	FSLabel    string
	Type       string
}

We only manage sizes in sectors unit for the Partition struct and sgdisk wrapper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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