configStep

package
v0.0.0-...-b79a0d8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package configStep implements manufacturing steps that can be specified in manufData.json. This step can have one or more downloadable files and one or more executed commands. It can be run at different points in the manufacturing process, and individual command success/failure can be required or ignored.

Files with suffix '.tar.xz' or '.txz' are automatically extracted into the temp dir.

Commands first have templating resolved, then are split into args via github.com/google/shlex. Commands for a step are executed in order. Steps with the same When value are executed in the order listed in json.

Index

Constants

This section is empty.

Variables

View Source
var (
	EEXECSUCCESS = fmt.Errorf("Execution succeeded but must fail")
	EEXECFAIL    = fmt.Errorf("Execution failed but must succeed")
)

Functions

func AddPWs

func AddPWs(biospass, ipmipass, ospass string)

call once passwords are known

Types

type CommonData

type CommonData struct {
	RecoveryDir string // where RECOVERY volume is mounted
	Serial      string // unit serial number
	BiosPass    string // what the bios password has been/will be set to
	IpmiPass    string // ditto, for ipmi
	OSPass      string // ditto, for OS
}

Data usable in step templates, but not unique to any one step

var CommonTemplateData CommonData

type ConfigSteps

type ConfigSteps []Step

func (ConfigSteps) RunApplicable

func (c ConfigSteps) RunApplicable(When WhenType) (success bool)

type ExitStatus

type ExitStatus int
const (
	ESMustSucceed ExitStatus = iota
	ESDontCare
	ESMustFail
)

func (*ExitStatus) UnmarshalJSON

func (es *ExitStatus) UnmarshalJSON(b []byte) error

type PlatformConfig

type PlatformConfig struct {
	DevCodeName string
	ConfigSteps ConfigSteps
}

A set of config steps for a platform.

type PlatformConfigs

type PlatformConfigs []PlatformConfig

func (PlatformConfigs) Find

func (configs PlatformConfigs) Find(codeName string) (cs ConfigSteps)

type Step

type Step struct {
	Name     string
	When     WhenType
	Files    []xfer.TVFile
	Commands []StepCmd
	Verbose  bool
	// contains filtered or unexported fields
}

A Step specifies a sequence of 0 or more file downloads followed by 0 or more command executions. Commands are subject to template expansion.

func (*Step) Run

func (s *Step) Run() (err error)

Run takes actions necessary to complete a step. That is, it downloads listed files and then runs listed commands. Any command whose exit code does not match the specified value causes Run() to exit with error.

type StepCmd

type StepCmd struct {
	ExitStatus          ExitStatus
	Command             string
	AddPath, AddLibPath string
}
A command to be executed during a Step. Command, AddPath, and AddLibPath are subject

** to template expansion using the values in StepData (which includes CommonData). ** Templating is via golang's package text/template. ** ** Example: Print the serial number ** Command could be "echo 'Serial number is {{.Serial}}'". ** If the serial is SN123, the command would print "Serial number is SN123". ** ** Example: Execute a binary auto-extracted from a .tar.xz file ** Command could be "{{.DLDir}}/path/in/tar/to/binary --arg --arg2" ** {{.DLDir}} would be replaced with the temp dir, resulting in an absolute path, and ** the executable is executed (assuming correct file mode). ** ** Note that passwords won't be available until close to the password-setting step. ** Also note that AddPath only applies to additional executables used by Command, and cannot be used to search for Command itself. ** AddLibPath, however, _will_ apply to Command.

type StepData

type StepData struct {
	*CommonData
	DLDir string //temp dir where file(s) for this step were downloaded
}

All data for step templates, including step-specific data (currently only DLDir)

type WhenType

type WhenType int
const (
	RunBeforeQA WhenType = iota
	RunAfterQA
	RunBeforeImaging
	RunAfterImaging
	RunBeforeMfg
	RunAfterMfg
	RunBeforePWSet
	RunAfterPWSet
)

func (*WhenType) UnmarshalJSON

func (wt *WhenType) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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