statemachine

package
v0.0.0-...-a201917 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 47 Imported by: 0

Documentation

Overview

Package statemachine provides the functions and structs to set up and execute a state machine based ubuntu-image build

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteSnapManifest

func WriteSnapManifest(snapsDir string, outputPath string) error

WriteSnapManifest generates a snap manifest based on the contents of the selected snapsDir

Types

type ClassicStateMachine

type ClassicStateMachine struct {
	StateMachine
	ImageDef imagedefinition.ImageDefinition
	Args     commands.ClassicArgs
}

ClassicStateMachine embeds StateMachine and adds the command line flags specific to classic images

func (*ClassicStateMachine) Setup

func (classicStateMachine *ClassicStateMachine) Setup() error

Setup assigns variables and calls other functions that must be executed before Run()

type PackStateMachine

type PackStateMachine struct {
	StateMachine
	Opts commands.PackOpts
}

PackStateMachine embeds StateMachine and adds the command line flags specific to pack images

func (*PackStateMachine) Setup

func (packStateMachine *PackStateMachine) Setup() error

Setup assigns variables and calls other functions that must be executed before Run()

type SmInterface

type SmInterface interface {
	Setup() error
	Run() error
	Teardown() error
	SetCommonOpts(commonOpts *commands.CommonOpts, stateMachineOpts *commands.StateMachineOpts)
}

SmInterface allows different image types to implement their own setup/run/teardown functions

type SnapStateMachine

type SnapStateMachine struct {
	StateMachine
	Opts commands.SnapOpts
	Args commands.SnapArgs
}

SnapStateMachine embeds StateMachine and adds the command line flags specific to snap images

func (*SnapStateMachine) Setup

func (snapStateMachine *SnapStateMachine) Setup() error

Setup assigns variables and calls other functions that must be executed before Run().

type StateMachine

type StateMachine struct {
	CurrentStep   string        // tracks the current progress of the state machine
	StepsTaken    int           // counts the number of steps taken
	ConfDefPath   string        // directory holding the model assertion / image definition file
	YamlFilePath  string        // the location for the gadget yaml file
	IsSeeded      bool          // core 20 images are seeded
	RootfsVolName string        // volume on which the rootfs is located
	RootfsPartNum int           // rootfs partition number
	SectorSize    quantity.Size // parsed (converted) sector size
	RootfsSize    quantity.Size

	// imported from snapd, the info parsed from gadget.yaml
	GadgetInfo *gadget.Info

	// image sizes for parsing the --image-size flags
	ImageSizes  map[string]quantity.Size
	VolumeOrder []string

	// names of images for each volume
	VolumeNames map[string]string

	Packages []string
	Snaps    []string
	// contains filtered or unexported fields
}

StateMachine will hold the command line data, track the current state, and handle all function calls

func (*StateMachine) Run

func (stateMachine *StateMachine) Run() error

Run iterates through the state functions, stopping when appropriate based on --until and --thru

func (*StateMachine) SetCommonOpts

func (stateMachine *StateMachine) SetCommonOpts(commonOpts *commands.CommonOpts,
	stateMachineOpts *commands.StateMachineOpts)

SetCommonOpts stores the common options for all image types in the struct

func (*StateMachine) Teardown

func (stateMachine *StateMachine) Teardown() error

Teardown handles anything else that needs to happen after the states have finished running

Jump to

Keyboard shortcuts

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