core

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: GPL-3.0 Imports: 65 Imported by: 0

Documentation

Overview

Package core contains the entire implementation of the Laforge configuration language. It includes it's own loader and dependency resolution mechanisms and is meant to be the source of truth around declaration logic.

Index

Constants

View Source
const (
	// ZeroDifficulty is a zero difficulty finding
	ZeroDifficulty FindingDifficulty = iota

	// NoviceDifficulty is a novice difficulty finding
	NoviceDifficulty

	// AdvancedDifficulty is an advanced difficulty finding
	AdvancedDifficulty

	// ExpertDifficulty is an expert difficulty finding
	ExpertDifficulty

	// ZeroSeverity is a zero severity finding
	ZeroSeverity FindingSeverity = iota

	// LowSeverity is a low severity finding
	LowSeverity

	// MediumSeverity is a medium severity finding
	MediumSeverity

	// HighSeverity is a high severity finding
	HighSeverity

	// CriticalSeverity is a critical severity finding
	CriticalSeverity
)
View Source
const (
	// DefaultPathToLocalStateFile is the path to a local copy of the state file for a local state
	DefaultPathToLocalStateFile = "terraform.tfstate"

	// DefaultPathToRemoteStateFile is the path to a local copy of the state file for a remote state
	DefaultPathToRemoteStateFile = ".terraform/terraform.tfstate"
)
View Source
const (
	// RevStatusUnknown is when the resource can be assumed to be destoryed or MIA
	RevStatusUnknown RevStatus = `UNKNOWN`

	// RevStatusStale is when the resource is no longer used by outside systems (non-existent terraform host)
	RevStatusStale RevStatus = `STALE`

	// RevStatusActive is when the resource has actively been created successfully
	RevStatusActive RevStatus = `ACTIVE`

	// RevStatusPlanned is when the resource doesnt require a config change, but has not been created yet.
	RevStatusPlanned RevStatus = `PLANNED`

	// RevStatusFailed is when the resource was attempted to have been created, but failed in the process.
	RevStatusFailed RevStatus = `FAILED`

	// RevModTouch describes a revision that needs to be updated on disk
	RevModTouch RevMod = `TOUCH`

	// RevModDelete describes a revision that needs to be deleted off disk
	RevModDelete RevMod = `DELETE`

	// RevModCreate describes a revision that needs to be created on disk
	RevModCreate RevMod = `CREATE`

	// RevModRebuild describes a revision that needs to be rebuilt due to human declaration
	RevModRebuild RevMod = `REBUILD`
)
View Source
const (
	// DBKeySnapshot is the database key for persisting the snapshot in our local filesystem
	DBKeySnapshot = `/snapshot`
)
View Source
const (
	// DefaultShebang is added at the top of a SSH script file
	DefaultShebang = "#!/bin/bash\n"
)
View Source
const (
	// NullIP is represents an IP that is unknown to our systems
	NullIP string = `0.0.0.0`
)

Variables

View Source
var (
	// ErrContextViolation is an error thrown when an action is taken that attempts to exceed the current state's ScopeContext
	ErrContextViolation = errors.New("context scope violation")

	// ErrAbsPathDeclNotExist is thrown when an absolute path is listed in a file yet it cannot be resolved on the local system
	ErrAbsPathDeclNotExist = errors.New("absolute path was not found on local system")

	// ErrInvalidEnvName is thrown when an environment name does not meet specified regulations around environment naming conventions
	ErrInvalidEnvName = errors.New("environment names can only contain lowercase alphanumeric and dash characters (a valid subdomain)")

	// ErrDeprecatedID is thrown when an object using a deprecated ID format is loaded
	ErrDeprecatedID = errors.New("the object is using a deprecated ID format and should be updated")

	// ErrInvalidIDFormat is thrown when an object using an invalid ID format is loaded
	ErrInvalidIDFormat = errors.New("object ID does not meet valid ID requirements")

	// ValidIDRegexp is the format for the new object ID schema.
	ValidIDRegexp = regexp.MustCompile(`\A[a-z0-9][a-z0-9\-]{1,34}[a-z0-9]\z`)

	// ValidOldIDRegexp is the old ID schema that allowed additional characters (periods and underscores)
	// and did not validate minimum or maximum length. These formats often incurred incompatabilities with
	// existing systems and will be deprecated.
	ValidOldIDRegexp = regexp.MustCompile(`\A[a-zA-Z0-9][a-zA-Z0-9\-\_\.]{2,34}[a-zA-Z0-9]\z`)
)
View Source
var (
	// ErrNoGlobalConfig is thrown when there is no global configuration for a user
	ErrNoGlobalConfig = errors.New("no global configuration exists")

	// ErrNoConfigRootReached is thrown when the entire filesystem has been traversed to the root without locating a valid config file
	ErrNoConfigRootReached = errors.New("no valid config file was located between current directory and the filesystem root")
)
View Source
var (
	// ErrInvalidDifficulty is thrown if the difficulty is invalid
	ErrInvalidDifficulty = errors.New("difficulty does not fall within valid range of 0-3")

	// ErrInvalidSeverity is thrown if the difficulty is invalid
	ErrInvalidSeverity = errors.New("severity does not fall within valid range of 0-3")
)
View Source
var (

	// ErrPathEndsInSlash is thrown when a path ends in a trailing slash
	ErrPathEndsInSlash = errors.New("path ends in a trailing slash")

	// ErrPathContainsInvalidChars is thrown when a path contains invalid characters
	ErrPathContainsInvalidChars = errors.New("path contains invalid characters")

	// ErrPathContainsDuplicateSlash is thrown when a path contains two consecutive slashes
	ErrPathContainsDuplicateSlash = errors.New("path contains consecutive slash characters")
)
View Source
var (
	// PrivateIPOutputRegexp matches outputs for private IP addresses
	PrivateIPOutputRegexp = regexp.MustCompile(`\A(\w+)\.private_ip\z`)

	// PublicIPOutputRegexp matches outputs for private IP addresses
	PublicIPOutputRegexp = regexp.MustCompile(`\A(\w+)\.public_ip\z`)
)
View Source
var (
	// ErrInvalidShellConfigType is thrown when an invalid shellconfig type is passed into a connection handler
	ErrInvalidShellConfigType = errors.New("invalid shell configuration provided to connection handler")
)
View Source
var (
	// ErrSnapshotsMatch is thrown when two snapshots are functionally the same during delta calculation
	ErrSnapshotsMatch = errors.New("snapshots reflected the same state")
)
View Source
var (
	// ErrSwapTypeMismatch is thrown when a Swap() function on the Mergeable interface cannot find it's native type
	ErrSwapTypeMismatch = errors.New("mergeable swap() call failed due to delta type mismatch")
)
View Source
var (

	// ErrTimeoutExceeded is thrown when the timeout has exceeded for this task
	ErrTimeoutExceeded = errors.New("timeout has exceeded for task step")
)
View Source
var (
	// ExampleObjects holds a map of example objects
	ExampleObjects = map[string]interface{}{
		"ami":         defaultAMI(),
		"command":     defaultCommand(),
		"dns_record":  defaultDNSRecord(),
		"identity":    defaultIdentity(),
		"network":     defaultNetwork(),
		"remote_file": defaultRemoteFile(),
		"script":      defaultScript(),
		"host":        defaultHost(),
		"environment": defaultEnvironment(),
	}
)
View Source
var TemplateFuncLib = template.FuncMap{
	"hclstring":  QuotedHCLString,
	"N":          iter.N,
	"UnsafeAtoi": UnsafeStringAsInt,
	"Decr":       Decr,
}

TemplateFuncLib is a standard template library of functions

View Source
var (
	// ValidEnvNameRegexp is a regular expression that can be used to validate environment names
	ValidEnvNameRegexp = regexp.MustCompile(`\A[a-z0-9][a-z0-9\-]*?[a-z0-9]\z`)
)

Functions

func BuildDirFromEnvRoot

func BuildDirFromEnvRoot(envroot string) string

BuildDirFromEnvRoot is a convenience function to get a prebuilt filepath to the build directory for an env root.

func CalculateTerraformNeeds

func CalculateTerraformNeeds(plan *Plan) (map[string][]string, error)

CalculateTerraformNeeds attempts to determine what terraform steps must happen first for a given plan.

func ConnectFunc

func ConnectFunc(network, addr string) func() (net.Conn, error)

ConnectFunc is a convenience method for returning a function that just uses net.Dial to communicate with the remote end that is suitable for use with the SSH communicator configuration.

func CreateGlobalConfig

func CreateGlobalConfig(u User) error

CreateGlobalConfig writes a User configuration to ~/.laforge/global.laforge

func Decr

func Decr(i int) int

Decr is a template helper function to non-destructively decrement an integer

func DependencyCost

func DependencyCost(d Dependency) int64

DependencyCost returns a pre-specified cost for paths within the graph traversal

func DependencyType

func DependencyType(d Dependency) string

DependencyType is used to return a string representation of the ObjectType of a dependency

func ExampleObjectByName

func ExampleObjectByName(name string) ([]byte, error)

ExampleObjectByName retrieves a templated example object of type (name)

func FileGlobResolver

func FileGlobResolver(baseDir string, parser *hcl2parse.Parser, loader *Loader) include.Resolver

FileGlobResolver is a modified FileResolver in the HCLv2 include extension that accounts for globbed includes:

include {
	path = "./foo/*.laforge"
}

func FindTerraformExecutable

func FindTerraformExecutable() (string, error)

FindTerraformExecutable attempts to find the terraform executable in the given path

func GetEmptyObjByName

func GetEmptyObjByName(s string) (interface{}, error)

GetEmptyObjByName returns a pointer to an initialized, but empty object of the specified type (camel case).

func GetTeamIDFromPath

func GetTeamIDFromPath(p string) (string, error)

GetTeamIDFromPath attempts to resolve the team's unique ID from the provided ID

func GlobalConfigDir

func GlobalConfigDir() (string, error)

GlobalConfigDir attempts to retrieve the user's global configuration directory (dotfile in $HOME)

func HCLBytesToObject

func HCLBytesToObject(data []byte, v interface{}) error

HCLBytesToObject renders bytes into an object of a specific type

func HashConfigMap

func HashConfigMap(m map[string]string) []uint64

HashConfigMap is used to hash the configuration map in a deterministic order

func IPv42Int

func IPv42Int(ip net.IP) uint32

IPv42Int converts net.IP address objects to their uint32 representation

func InitializeBuildDirectory

func InitializeBuildDirectory(l *Laforge, overwrite, update bool) error

InitializeBuildDirectory creates a build directory structure and writes the build.db as a precursor to builder's taking over.

func Int2IPv4

func Int2IPv4(nn uint32) net.IP

Int2IPv4 converts uint32s to their net.IP object

func IsGlobalType

func IsGlobalType(p string) bool

IsGlobalType is a helper function that attempts to determine if the specified path is of a global type

func LoadHCLFromFile

func LoadHCLFromFile(fileloc string, v interface{}) error

LoadHCLFromFile attempts to load and parse an HCL file with a filepath location

func LocateBaseConfig

func LocateBaseConfig() (string, error)

LocateBaseConfig attempts to locate a valid base.laforge in the current directory or one of it's parents

func LocateBuildConfig

func LocateBuildConfig() (string, error)

LocateBuildConfig attempts to locate a valid env.laforge in the current directory or it's parents

func LocateEnvConfig

func LocateEnvConfig() (string, error)

LocateEnvConfig attempts to locate a valid env.laforge in the current directory or it's parents

func LocateGlobalConfig

func LocateGlobalConfig() (string, error)

LocateGlobalConfig attempts to detect a global configuration in the GlobalConfigDir

func LocateTeamConfig

func LocateTeamConfig() (string, error)

LocateTeamConfig attempts to locate a valid team.laforge in the current directory or it's parents

func NewMergeConflict

func NewMergeConflict(
	base, layer interface{},
	baseid, layerid string,
	baseCaller, layerCaller CallFile,
) error

NewMergeConflict is a helper function that creates a nicely formatted error when a merge conflict fails during an object differential update.

func OutdatedID

func OutdatedID(id string) bool

OutdatedID checks to determine if the ID is in an outdated format.

func PathExists

func PathExists(loc string) bool

PathExists is a convenience function to determine if a path exists at it's location

func PerformInTimeout added in v0.2.1

func PerformInTimeout(seconds int, f TimeoutFunc) error

PerformInTimeout will perform the TimeoutFunc f every 500ms until it either returns NOT an ErrTimeoutExtensionRequested or nil

func QuotedHCLString

func QuotedHCLString(s string) string

QuotedHCLString is a template function to render safe HCLv2 strings

func RenderHCLv2Object

func RenderHCLv2Object(i interface{}) ([]byte, error)

RenderHCLv2Object is a generic templating function for HCLv2 compatible types

func SSHClientConfig

func SSHClientConfig(sshconf *SSHAuthConfig, overrideKey string) (*ssh.ClientConfig, error)

SSHClientConfig attempts to create an x/ssh client configuration for connection authentication

func StatusMap

func StatusMap(curr StateContext) string

StatusMap gives a visual representation of the current state context

func TouchGitKeep

func TouchGitKeep(p string) error

TouchGitKeep is a helper function to touch a .gitkeep file within a given directory.

func TraverseUpForFile

func TraverseUpForFile(filename, startdir string) (string, error)

TraverseUpForFile looks for a file by the given filename upwards in the file structure

func UnsafeStringAsInt

func UnsafeStringAsInt(s string) int

UnsafeStringAsInt is a template helper function that will return -1 if it cannot convert the string to an integer.

func UserWizard

func UserWizard() error

UserWizard runs an interactive prompt to get the user's information.

func ValidEnvName

func ValidEnvName(name string) bool

ValidEnvName is a helper function to determine if a supplied name is a valid environment name

func ValidID

func ValidID(id string) bool

ValidID checks to determine if the string conforms to laforge ID schemas.

func ValidateGenericPath

func ValidateGenericPath(p string) error

ValidateGenericPath covers basic rules validating a path generically for invalid schema

Types

type AMI

type AMI struct {
	ID          string            `hcl:"id,label" json:"id,omitempty"`
	Name        string            `hcl:"name,attr" json:"name,omitempty"`
	Description string            `hcl:"description,attr" json:"description,omitempty"`
	Provider    string            `hcl:"provider,attr" json:"provider,omitempty"`
	Username    string            `hcl:"username,attr" json:"username,omitempty"`
	Vars        map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags        map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	Maintainer  *User             `hcl:"maintainer,block" json:"maintainer,omitempty"`
}

AMI represents a configurable object for defining custom AMIs in cloud infrastructure

func (AMI) MarshalEasyJSON

func (v AMI) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AMI) MarshalJSON

func (v AMI) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AMI) UnmarshalEasyJSON

func (v *AMI) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AMI) UnmarshalJSON

func (v *AMI) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Build

type Build struct {
	ID           string            `hcl:"id,label" json:"id,omitempty"`
	TeamCount    int               `hcl:"team_count,attr" json:"team_count,omitempty"`
	Config       map[string]string `hcl:"config,attr" json:"config,omitempty"`
	Tags         map[string]string `hcl:"tags,attr" json:"tags,omitempty"`
	Maintainer   *User             `hcl:"maintainer,block" json:"maintainer,omitempty"`
	Revision     int64             `hcl:"revision,attr" json:"revision,omitempty"`
	OnConflict   *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	PathFromBase string            `hcl:"path_from_base,optional" json:"path_from_base,omitempty"`
	Environment  *Environment      `json:"-"`
	Competition  *Competition      `json:"-"`
	RelEnvPath   string            `json:"-"`
	Dir          string            `json:"-"`
	Caller       Caller            `json:"-"`
	LocalDBFile  *LocalFileRef     `json:"-"`
	Teams        map[string]*Team  `json:"-"`
}

Build represents the output of a laforge build

func (*Build) AssetForTeam

func (b *Build) AssetForTeam(teamID int, assetName string) string

AssetForTeam is a template helper function that returns the location of team specific assets

func (*Build) Associate

func (b *Build) Associate(g *Snapshot) error

Associate walks the build and creates edges in the graph

func (*Build) Base

func (b *Build) Base() string

Base implements the Pather interface

func (*Build) CreateTeam

func (b *Build) CreateTeam(tid int) *Team

CreateTeam creates a new team of a given team index for the build.

func (*Build) CreateTeams

func (b *Build) CreateTeams() error

CreateTeams enumerates the build's team count and generates children team objects

func (*Build) Gather

func (b *Build) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Build) GetCaller

func (b *Build) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Build) GetOnConflict

func (b *Build) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Build) Hash

func (b *Build) Hash() uint64

Hash implements the Hasher interface

func (*Build) LaforgeID

func (b *Build) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Build) MarshalEasyJSON

func (v Build) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Build) MarshalJSON

func (v Build) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Build) ParentLaforgeID

func (b *Build) ParentLaforgeID() string

ParentLaforgeID returns the build's parent environment ID

func (*Build) Path

func (b *Build) Path() string

Path implements the Pather interface

func (*Build) RelAssetForTeam

func (b *Build) RelAssetForTeam(networkBase, hostBase, assetName string) string

RelAssetForTeam is a template helper function that returns the relative location of team specific assets

func (*Build) SetCaller

func (b *Build) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*Build) SetID

func (b *Build) SetID() string

SetID generates a unique build ID for this build

func (*Build) SetOnConflict

func (b *Build) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Build) Swap

func (b *Build) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Build) UnmarshalEasyJSON

func (v *Build) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Build) UnmarshalJSON

func (v *Build) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Build) ValidatePath

func (b *Build) ValidatePath() error

ValidatePath implements the Pather interface

type CallFile

type CallFile struct {
	CallerFile string
	CallerDir  string
}

CallFile is a debug type for tracking any file a configuration object was referenced in

type Caller

type Caller []CallFile

Caller represents a call chain in FIFO order of all a configuration object's CallFiles

func NewCaller

func NewCaller(src string) Caller

NewCaller returns a first generation Caller with a origin CallFile embedded inside

func (Caller) Current

func (c Caller) Current() CallFile

Current retrieves the latest configuration file that has touched an object

func (Caller) Error

func (c Caller) Error() string

func (Caller) Stack

func (c Caller) Stack(n Caller) Caller

Stack pushes a new Call stack (n) down onto the original Call stack (c)

type ChecksumList

type ChecksumList []uint64

ChecksumList is a type alias for a set of computed hashes

func (ChecksumList) Hash

func (c ChecksumList) Hash() uint64

Hash implements the hasher interface

func (ChecksumList) Len

func (c ChecksumList) Len() int

Len implements the sort interface

func (ChecksumList) Less

func (c ChecksumList) Less(i, j int) bool

Less implements the sort interface

func (ChecksumList) MarshalEasyJSON

func (v ChecksumList) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ChecksumList) MarshalJSON

func (v ChecksumList) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (ChecksumList) Swap

func (c ChecksumList) Swap(i, j int)

Swap implements the sort interface

func (*ChecksumList) UnmarshalEasyJSON

func (v *ChecksumList) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ChecksumList) UnmarshalJSON

func (v *ChecksumList) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Command

type Command struct {
	ID           string            `hcl:"id,label" json:"id,omitempty"`
	Name         string            `hcl:"name,attr" json:"name,omitempty"`
	Description  string            `hcl:"description,attr" json:"description,omitempty"`
	Program      string            `hcl:"program,attr" json:"program,omitempty"`
	Args         []string          `hcl:"args,attr" json:"args,omitempty"`
	IgnoreErrors bool              `hcl:"ignore_errors,attr" json:"ignore_errors,omitempty"`
	Cooldown     int               `hcl:"cooldown,attr" json:"cooldown,omitempty"`
	IO           *IO               `hcl:"io,block" json:"io,omitempty"`
	Disabled     bool              `hcl:"disabled,attr" json:"disabled,omitempty"`
	Vars         map[string]string `hcl:"vars,attr" json:"vars,omitempty"`
	Tags         map[string]string `hcl:"tags,attr" json:"tags,omitempty"`
	OnConflict   *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Maintainer   *User             `hcl:"maintainer,block" json:"maintainer,omitempty"`
	Caller       Caller            `json:"-"`
}

Command represents an executable command that can be defined as part of a host configuration step

func (*Command) Base

func (c *Command) Base() string

Base implements the Pather interface

func (*Command) CommandString

func (c *Command) CommandString() string

CommandString is a template helper function to embed commands into the output

func (*Command) Fullpath

func (c *Command) Fullpath() string

Fullpath implements the Pather interface

func (*Command) Gather

func (c *Command) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Command) GetCaller

func (c *Command) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Command) GetOnConflict

func (c *Command) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Command) Hash

func (c *Command) Hash() uint64

Hash implements the Hasher interface

func (*Command) Kind

func (c *Command) Kind() string

Kind implements the Provisioner interface

func (*Command) LaforgeID

func (c *Command) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Command) MarshalEasyJSON

func (v Command) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Command) MarshalJSON

func (v Command) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Command) ParentLaforgeID

func (c *Command) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*Command) Path

func (c *Command) Path() string

Path implements the Pather interface

func (*Command) SetCaller

func (c *Command) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*Command) SetOnConflict

func (c *Command) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Command) Swap

func (c *Command) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Command) UnmarshalEasyJSON

func (v *Command) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Command) UnmarshalJSON

func (v *Command) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Command) ValidatePath

func (c *Command) ValidatePath() error

ValidatePath implements the Pather interface

type CommandJob

type CommandJob struct {
	GenericJob
	Command          []string         `json:"command"`
	GoodOutputRegexp string           `json:"good_output_regexp"`
	Target           *ProvisionedHost `json:"-"`
}

CommandJob attempts to execute remote commands on the system easyjson:json

func (*CommandJob) CanProceed

func (j *CommandJob) CanProceed() error

CanProceed implements the Doer interface

func (*CommandJob) CleanUp

func (j *CommandJob) CleanUp() error

CleanUp implements the Doer interface

func (*CommandJob) Do

func (j *CommandJob) Do() error

Do implements the Doer interface

func (*CommandJob) EnsureDependencies

func (j *CommandJob) EnsureDependencies(l *Laforge) error

EnsureDependencies implements the Doer interface

func (*CommandJob) Finish

func (j *CommandJob) Finish() error

Finish implements the Doer interface

func (CommandJob) MarshalEasyJSON

func (v CommandJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CommandJob) MarshalJSON

func (v CommandJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CommandJob) UnmarshalEasyJSON

func (v *CommandJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CommandJob) UnmarshalJSON

func (v *CommandJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Competition

type Competition struct {
	ID           string            `hcl:"id,label" json:"id,omitempty"`
	BaseDir      string            `hcl:"base_dir,optional" json:"base_dir,omitempty"`
	RootPassword string            `hcl:"root_password,attr" json:"root_password,omitempty"`
	DNS          *DNS              `hcl:"dns,block" json:"dns,omitempty"`
	Remote       *Remote           `hcl:"remote,block" json:"remote,omitempty"`
	Config       map[string]string `hcl:"config,optional" json:"config,omitempty"`
	OnConflict   *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Caller       Caller            `json:"-"`
}

Competition is a configurable type that holds competition wide settings

func (*Competition) Base

func (c *Competition) Base() string

Base implements the Pather interface

func (*Competition) GetCaller

func (c *Competition) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Competition) GetOnConflict

func (c *Competition) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Competition) Hash

func (c *Competition) Hash() uint64

Hash implements the Hasher interface

func (*Competition) LaforgeID

func (c *Competition) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Competition) MarshalEasyJSON

func (v Competition) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Competition) MarshalJSON

func (v Competition) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Competition) PasswordForHost

func (c *Competition) PasswordForHost(h *Host) string

PasswordForHost is a template helper function to allow a overridden password to be retrieved

func (*Competition) Path

func (c *Competition) Path() string

Path implements the Pather interface

func (*Competition) SetCaller

func (c *Competition) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*Competition) SetOnConflict

func (c *Competition) SetOnConflict(oc OnConflict)

SetOnConflict implements the Mergeable interface

func (*Competition) Swap

func (c *Competition) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Competition) UnmarshalEasyJSON

func (v *Competition) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Competition) UnmarshalJSON

func (v *Competition) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Competition) ValidatePath

func (c *Competition) ValidatePath() error

ValidatePath implements the Pather interface

type Connection

type Connection struct {
	ID                 string              `hcl:"id,label" json:"id,omitempty"`
	Active             bool                `hcl:"active,attr" json:"active,omitempty"`
	LocalAddr          string              `hcl:"local_addr,attr" json:"local_addr,omitempty"`
	RemoteAddr         string              `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
	ResourceName       string              `hcl:"resource_name,attr" json:"resource_name,omitempty"`
	SSHAuthConfig      *SSHAuthConfig      `hcl:"ssh,block" json:"ssh,omitempty"`
	WinRMAuthConfig    *WinRMAuthConfig    `hcl:"winrm,block" json:"winrm,omitempty"`
	Revision           int64               `hcl:"revision,optional" json:"revision,omitempty"`
	OnConflict         *OnConflict         `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Competition        *Competition        `json:"-"`
	Environment        *Environment        `json:"-"`
	Build              *Build              `json:"-"`
	Team               *Team               `json:"-"`
	Network            *Network            `json:"-"`
	Host               *Host               `json:"-"`
	ProvisionedHost    *ProvisionedHost    `json:"-"`
	ProvisionedNetwork *ProvisionedNetwork `json:"-"`
	Caller             Caller              `json:"-"`
}

Connection defines an access method provisioned host within a team's environment

func (*Connection) Base

func (c *Connection) Base() string

Base implements the Pather interface

func (*Connection) DeleteScriptSFTP

func (c *Connection) DeleteScriptSFTP(remotefile string) error

DeleteScriptSFTP uses the really nice golang SFTP client to zero and delete remote files

func (*Connection) ExecuteCommand

func (c *Connection) ExecuteCommand(cmd *RemoteCommand) error

ExecuteCommand is the generic interface for a connection to execute a command on the remote system

func (*Connection) ExecuteCommandSSH

func (c *Connection) ExecuteCommandSSH(cmd *RemoteCommand) error

ExecuteCommandSSH executes a remote command over SSH

func (*Connection) ExecuteCommandWinRM

func (c *Connection) ExecuteCommandWinRM(cmd *RemoteCommand) error

ExecuteCommandWinRM executes a remote command over WinRM

func (*Connection) Gather

func (c *Connection) Gather(s *Snapshot) error

Gather implements the dependency interface

func (*Connection) GetCaller

func (c *Connection) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Connection) GetOnConflict

func (c *Connection) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Connection) Hash

func (c *Connection) Hash() uint64

Hash implements the Hasher interface

func (*Connection) InteractiveSSH

func (c *Connection) InteractiveSSH() error

InteractiveSSH launches an interactive shell over SSH

func (*Connection) InteractiveWinRM

func (c *Connection) InteractiveWinRM() error

InteractiveWinRM launches an interactive shell over WinRM

func (*Connection) IsSSH

func (c *Connection) IsSSH() bool

IsSSH is a convenience method for checking if the provisioned host is setup for remote SSH

func (*Connection) IsWinRM

func (c *Connection) IsWinRM() bool

IsWinRM is a convenience method for checking if the provisioned host is setup for remote WinRM

func (*Connection) LaforgeID

func (c *Connection) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Connection) MarshalEasyJSON

func (v Connection) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Connection) MarshalJSON

func (v Connection) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Connection) ParentLaforgeID

func (c *Connection) ParentLaforgeID() string

ParentLaforgeID returns connections parent provisioned host

func (*Connection) Path

func (c *Connection) Path() string

Path implements the Pather interface

func (*Connection) RemoteShell

func (c *Connection) RemoteShell() error

RemoteShell connects your local console to a remote provisioned host

func (*Connection) SetCaller

func (c *Connection) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*Connection) SetID

func (c *Connection) SetID() string

SetID increments the revision and sets the ID if needed

func (*Connection) SetOnConflict

func (c *Connection) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Connection) Swap

func (c *Connection) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Connection) UnmarshalEasyJSON

func (v *Connection) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Connection) UnmarshalJSON

func (v *Connection) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Connection) Upload

func (c *Connection) Upload(src, dst string) error

Upload uploads a src file/dir to a dst file/dir on the provisioned host

func (*Connection) UploadExecuteAndDelete

func (c *Connection) UploadExecuteAndDelete(j Doer, scriptsrc string, tmpname string, logdir string) error

UploadExecuteAndDelete is a helper function to chain together a common pattern of execution

func (*Connection) UploadSCP

func (c *Connection) UploadSCP(src, dst string) error

UploadSCP uses scp to upload src to dst on the provisioned host

func (*Connection) UploadSFTP

func (c *Connection) UploadSFTP(src, dst string) error

UploadSFTP uses the really nice golang SFTP client to upload remote files

func (*Connection) UploadScriptSFTP

func (c *Connection) UploadScriptSFTP(src, dst string) error

UploadScriptSFTP uses the really nice golang SFTP client to upload remote files

func (*Connection) UploadWinRM

func (c *Connection) UploadWinRM(src, dst string) error

UploadWinRM uses WinRM to upload src to dst on the provisioned host

func (*Connection) ValidatePath

func (c *Connection) ValidatePath() error

ValidatePath implements the Pather interface

type DNS

type DNS struct {
	ID         string            `hcl:"id,label" json:"id,omitempty"`
	Type       string            `hcl:"type,attr" json:"type,omitempty"`
	RootDomain string            `hcl:"root_domain,attr" json:"root_domain,omitempty"`
	DNSServers []string          `hcl:"dns_servers,attr" json:"dns_servers,omitempty"`
	NTPServers []string          `hcl:"ntp_servers,optional" json:"ntp_servers,omitempty"`
	Config     map[string]string `hcl:"config,optional" json:"config,omitempty"`
	OnConflict *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Caller     Caller            `json:"-"`
}

DNS represents a configurable type for the creation of competition DNS infrastructure

func (*DNS) GetCaller

func (d *DNS) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*DNS) GetOnConflict

func (d *DNS) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*DNS) Hash

func (d *DNS) Hash() uint64

Hash implements the Hasher interface

func (*DNS) LaforgeID

func (d *DNS) LaforgeID() string

LaforgeID implements the Mergeable interface

func (DNS) MarshalEasyJSON

func (v DNS) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DNS) MarshalJSON

func (v DNS) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DNS) SetCaller

func (d *DNS) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*DNS) SetOnConflict

func (d *DNS) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*DNS) Swap

func (d *DNS) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*DNS) UnmarshalEasyJSON

func (v *DNS) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DNS) UnmarshalJSON

func (v *DNS) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DNSRecord

type DNSRecord struct {
	ID         string            `hcl:"id,label" json:"id,omitempty"`
	Name       string            `hcl:"name,attr" json:"name,omitempty"`
	Values     []string          `hcl:"values,optional" json:"values,omitempty"`
	Type       string            `hcl:"type,attr" json:"type,omitempty"`
	Zone       string            `hcl:"zone,attr" json:"zone,omitempty"`
	Vars       map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags       map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	Disabled   bool              `hcl:"disabled,optional" json:"disabled,omitempty"`
	OnConflict *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Caller     Caller            `json:"-"`
}

DNSRecord is a configurable type for defining DNS entries related to this host in the core DNS infrastructure (if enabled)

func (*DNSRecord) Base

func (r *DNSRecord) Base() string

Base implements the Pather interface

func (*DNSRecord) Fullpath

func (r *DNSRecord) Fullpath() string

Fullpath implements the Pather interface

func (*DNSRecord) Gather

func (r *DNSRecord) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*DNSRecord) GetCaller

func (r *DNSRecord) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*DNSRecord) GetOnConflict

func (r *DNSRecord) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*DNSRecord) Hash

func (r *DNSRecord) Hash() uint64

Hash implements the Hasher interface

func (*DNSRecord) Inherited

func (r *DNSRecord) Inherited() bool

Inherited is a boolean condition that is triggered when a DNS record is not statically defined

func (*DNSRecord) Kind

func (r *DNSRecord) Kind() string

Kind implements the Provisioner interface

func (*DNSRecord) LaforgeID

func (r *DNSRecord) LaforgeID() string

LaforgeID implements the Mergeable interface

func (DNSRecord) MarshalEasyJSON

func (v DNSRecord) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DNSRecord) MarshalJSON

func (v DNSRecord) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DNSRecord) ParentLaforgeID

func (r *DNSRecord) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*DNSRecord) Path

func (r *DNSRecord) Path() string

Path implements the Pather interface

func (*DNSRecord) SetCaller

func (r *DNSRecord) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*DNSRecord) SetOnConflict

func (r *DNSRecord) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*DNSRecord) SetValue

func (r *DNSRecord) SetValue(val string)

SetValue is an override which allows you to set the value of a DNS record during a template run

func (*DNSRecord) Swap

func (r *DNSRecord) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*DNSRecord) UnmarshalEasyJSON

func (v *DNSRecord) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DNSRecord) UnmarshalJSON

func (v *DNSRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*DNSRecord) ValidatePath

func (r *DNSRecord) ValidatePath() error

ValidatePath implements the Pather interface

type DNSRecordJob

type DNSRecordJob struct {
	GenericJob
	Target    *ProvisioningStep `json:"-"`
	DNSRecord *DNSRecord        `json:"-"`
}

DNSRecordJob attempts to set a DNS record via NSUpdate easyjson:json

func (*DNSRecordJob) CanProceed

func (j *DNSRecordJob) CanProceed() error

CanProceed implements the Doer interface

func (*DNSRecordJob) CleanUp

func (j *DNSRecordJob) CleanUp() error

CleanUp implements the Doer interface

func (*DNSRecordJob) Do

func (j *DNSRecordJob) Do() error

Do implements the Doer interface

func (*DNSRecordJob) EnsureDependencies

func (j *DNSRecordJob) EnsureDependencies(l *Laforge) error

EnsureDependencies implements the Doer interface

func (*DNSRecordJob) Finish

func (j *DNSRecordJob) Finish() error

Finish implements the Doer interface

func (DNSRecordJob) MarshalEasyJSON

func (v DNSRecordJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DNSRecordJob) MarshalJSON

func (v DNSRecordJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DNSRecordJob) UnmarshalEasyJSON

func (v *DNSRecordJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DNSRecordJob) UnmarshalJSON

func (v *DNSRecordJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Dependency

type Dependency interface {
	Pather
	graph.Hasher
	ParentLaforgeID() string
	Gather(g *Snapshot) error
}

Dependency is an interface to define a laforge object that can be represented on the graph

type DependencyList

type DependencyList []int

DependencyList is a helper type alias to handle topological sorting of laforge state elements

type Disk

type Disk struct {
	Size int `cty:"size" hcl:"size,attr" json:"size,omitempty"`
}

Disk is a configurable type for setting the root volume's disk size in GB

func (Disk) MarshalEasyJSON

func (v Disk) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Disk) MarshalJSON

func (v Disk) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Disk) UnmarshalEasyJSON

func (v *Disk) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Disk) UnmarshalJSON

func (v *Disk) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Doer

type Doer interface {
	graph.Hasher
	GetTargetID() string
	CanProceed(e chan error)
	EnsureDependencies(e chan error)
	Do(e chan error)
	CleanUp(e chan error)
	Finish(e chan error)
	SetTimeout(t int)
	GetTimeout() int
	GetMetadata() *Metadata
	SetStatus(s JobStatus)
	StandardOutput(line string)
	StandardError(line string)
	SetPlan(p *Plan)
	SetBase(l *Laforge)
	CurrentStatus() JobStatus
}

Doer is an interface to describe types that may be executed in the flow

type Edge

type Edge struct {
	Source string `json:"source,omitempty"`
	Target string `json:"omitempty"`
}

Edge is a type to store relationship information in the graph easyjson:json

func CreateEdge

func CreateEdge(src Dependency, target Dependency) Edge

CreateEdge returns an edge creation data structure

func (Edge) MarshalEasyJSON

func (v Edge) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Edge) MarshalJSON

func (v Edge) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Edge) UnmarshalEasyJSON

func (v *Edge) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Edge) UnmarshalJSON

func (v *Edge) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Environment

type Environment struct {
	ID               string              `hcl:"id,label" json:"id,omitempty"`
	CompetitionID    string              `hcl:"competition_id,attr" json:"competition_id,omitempty"`
	Name             string              `hcl:"name,attr" json:"name,omitempty"`
	Description      string              `hcl:"description,attr" json:"description,omitempty"`
	Builder          string              `hcl:"builder,attr" json:"builder,omitempty"`
	TeamCount        int                 `hcl:"team_count,attr" json:"team_count,omitempty"`
	AdminCIDRs       []string            `hcl:"admin_ranges,attr" json:"admin_ranges,omitempty"`
	Config           map[string]string   `hcl:"config,optional" json:"config,omitempty"`
	Tags             map[string]string   `hcl:"tags,optional" json:"tags,omitempty"`
	Networks         []*IncludedNetwork  `hcl:"included_network,block" json:"included_networks,omitempty"`
	Maintainer       *User               `hcl:"maintainer,block" json:"maintainer,omitempty"`
	OnConflict       *OnConflict         `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	BaseDir          string              `hcl:"base_dir,optional" json:"base_dir,omitempty"`
	Revision         int64               `hcl:"revision,optional" json:"revision,omitempty"`
	Build            *Build              `json:"-"`
	IncludedNetworks map[string]*Network `json:"-"`
	IncludedHosts    map[string]*Host    `json:"-"`
	HostByNetwork    map[string][]*Host  `json:"-"`
	Teams            map[string]*Team    `json:"-"`
	Caller           Caller              `json:"-"`
	Competition      *Competition        `json:"-"`
}

Environment represents the basic configurable type for a Laforge environment container

func (*Environment) Base

func (e *Environment) Base() string

Base implements the Pather interface

func (*Environment) CreateBuild

func (e *Environment) CreateBuild() *Build

CreateBuild creates a fresh build object that is a child of the environment e.

func (*Environment) Gather

func (e *Environment) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Environment) GetCaller

func (e *Environment) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Environment) GetOnConflict

func (e *Environment) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Environment) Hash

func (e *Environment) Hash() uint64

Hash implements the Hasher interface

func (*Environment) LaforgeID

func (e *Environment) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Environment) MarshalEasyJSON

func (v Environment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Environment) MarshalJSON

func (v Environment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Environment) ParentLaforgeID

func (e *Environment) ParentLaforgeID() string

ParentLaforgeID returns the Team's parent build ID

func (*Environment) Path

func (e *Environment) Path() string

Path implements the Pather interface

func (*Environment) ResolveIncludedNetworks

func (e *Environment) ResolveIncludedNetworks(base *Laforge) error

ResolveIncludedNetworks walks the included_networks and included_hosts within the environment configuration ensuring that they can be located in the base laforge namespace.

func (*Environment) SetCaller

func (e *Environment) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*Environment) SetOnConflict

func (e *Environment) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Environment) Swap

func (e *Environment) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Environment) UnmarshalEasyJSON

func (v *Environment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Environment) UnmarshalJSON

func (v *Environment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Environment) ValidatePath

func (e *Environment) ValidatePath() error

ValidatePath implements the Pather interface

type ErrTimeoutExtension added in v0.2.1

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

ErrTimeoutExtension is a type used to request a timeout extension for the executor

func NewTimeoutExtension added in v0.2.1

func NewTimeoutExtension(err error) *ErrTimeoutExtension

NewTimeoutExtension creates a wrapped error for the scheduler to retry at a later time

func (*ErrTimeoutExtension) Cause added in v0.2.1

func (e *ErrTimeoutExtension) Cause() error

Cause implements the causer interface

func (*ErrTimeoutExtension) Error added in v0.2.1

func (e *ErrTimeoutExtension) Error() string

Error implements the error interface

type ExitError

type ExitError struct {
	Command    string
	ExitStatus int
	Err        error
}

ExitError is returned by Wait to indicate and error executing the remote command, or a non-zero exit status.

func (*ExitError) Error

func (e *ExitError) Error() string

Error implements the error interface

type Finding

type Finding struct {
	Name        string            `hcl:"name,attr" json:"name,omitempty"`
	Description string            `hcl:"description,optional" json:"description,omitempty"`
	Severity    FindingSeverity   `hcl:"severity,attr" json:"severity,omitempty"`
	Difficulty  FindingDifficulty `hcl:"difficulty,attr" json:"difficulty,omitempty"`
	Maintainer  *User             `hcl:"maintainer,block" json:"maintainer,omitempty"`
	Tags        []string          `hcl:"tags,optional" json:"tags,omitempty"`
	Provisioner Provisioner       `json:"-"`
	Host        *Host             `json:"-"`
}

Finding represents a finding to be aggregated for scoring inside a laforge scenario

func (Finding) MarshalEasyJSON

func (v Finding) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Finding) MarshalJSON

func (v Finding) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Finding) TotalScore

func (f *Finding) TotalScore() int

TotalScore returns the total score applicable to a Finding

func (*Finding) UnmarshalEasyJSON

func (v *Finding) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Finding) UnmarshalJSON

func (v *Finding) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FindingDifficulty

type FindingDifficulty int

FindingDifficulty is a type alias to the level of difficulty the finding exists as

func (FindingDifficulty) String

func (f FindingDifficulty) String() string

String implements the stringer interface

type FindingSeverity

type FindingSeverity int

FindingSeverity is a type alias to the level of severity the finding exists as

func (FindingSeverity) String

func (f FindingSeverity) String() string

String implements the stringer interface

type GenericJob

type GenericJob struct {
	JobID      string    `json:"job_id"`
	Plan       *Plan     `json:"-"`
	Base       *Laforge  `json:"-"`
	Offset     int       `json:"offset"`
	Timeout    int       `json:"timeout"`
	JobType    string    `json:"job_type"`
	Metadata   *Metadata `json:"-"`
	MetadataID string    `json:"metadata_id"`
	Status     JobStatus `json:"status"`
	CreatedAt  time.Time `json:"created_at,omitempty"`
	StartedAt  time.Time `json:"started_at,omitempty"`
	EndedAt    time.Time `json:"ended_at,omitempty"`
}

GenericJob is an embeddable type for standardizing laforge jobs easyjson:json

func (*GenericJob) CurrentStatus

func (j *GenericJob) CurrentStatus() JobStatus

CurrentStatus implements the Doer interface

func (*GenericJob) GetID

func (j *GenericJob) GetID() string

GetID implements the Relationship interface

func (*GenericJob) GetMetadata

func (j *GenericJob) GetMetadata() *Metadata

GetMetadata implements the Doer interface

func (*GenericJob) GetTargetID

func (j *GenericJob) GetTargetID() string

GetTargetID implements the Doer interface

func (*GenericJob) GetTimeout added in v0.2.1

func (j *GenericJob) GetTimeout() int

GetTimeout implements the Doer interface

func (*GenericJob) Hash

func (j *GenericJob) Hash() uint64

Hash implements the Hasher interface

func (GenericJob) MarshalEasyJSON

func (v GenericJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GenericJob) MarshalJSON

func (v GenericJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GenericJob) SetBase

func (j *GenericJob) SetBase(l *Laforge)

SetBase implements the Doer interface

func (*GenericJob) SetPlan

func (j *GenericJob) SetPlan(p *Plan)

SetPlan implements the Doer interface

func (*GenericJob) SetStatus

func (j *GenericJob) SetStatus(s JobStatus)

SetStatus implements the Doer interface

func (*GenericJob) SetTimeout

func (j *GenericJob) SetTimeout(t int)

SetTimeout implements the Doer interface

func (*GenericJob) StandardError added in v0.2.1

func (j *GenericJob) StandardError(line string)

StandardError prints the standard error of a jobs execution

func (*GenericJob) StandardOutput added in v0.2.1

func (j *GenericJob) StandardOutput(line string)

StandardOutput shows the standard output of a job's execution

func (*GenericJob) UnmarshalEasyJSON

func (v *GenericJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GenericJob) UnmarshalJSON

func (v *GenericJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Host

type Host struct {
	ID               string                 `cty:"id" hcl:"id,label" json:"id,omitempty"`
	Hostname         string                 `cty:"hostname" hcl:"hostname,attr" json:"hostname,omitempty"`
	Description      string                 `cty:"description" hcl:"description,optional" json:"description,omitempty"`
	OS               string                 `cty:"os" hcl:"os,attr" json:"os,omitempty"`
	AMI              string                 `cty:"ami" hcl:"ami,optional" json:"ami,omitempty"`
	LastOctet        int                    `cty:"last_octet" hcl:"last_octet,attr" json:"last_octet,omitempty"`
	InstanceSize     string                 `cty:"instance_size" hcl:"instance_size,attr" json:"instance_size,omitempty"`
	Disk             Disk                   `cty:"disk" hcl:"disk,block" json:"disk,omitempty"`
	ProvisionSteps   []string               `cty:"provision_steps" hcl:"provision_steps,optional" json:"provision_steps,omitempty"`
	ExposedTCPPorts  []string               `cty:"exposed_tcp_ports" hcl:"exposed_tcp_ports,optional" json:"exposed_tcp_ports,omitempty"`
	ExposedUDPPorts  []string               `cty:"exposed_udp_ports" hcl:"exposed_udp_ports,optional" json:"exposed_udp_ports,omitempty"`
	OverridePassword string                 `cty:"override_password" hcl:"override_password,optional" json:"override_password,omitempty"`
	UserGroups       []string               `cty:"user_groups" hcl:"user_groups,optional" json:"user_groups,omitempty"`
	Dependencies     []*HostDependency      `cty:"depends_on" hcl:"depends_on,block" json:"depends_on,omitempty"`
	IO               *IO                    `cty:"io" hcl:"io,block" json:"io,omitempty"`
	Vars             map[string]string      `cty:"vars" hcl:"vars,optional" json:"vars,omitempty"`
	Tags             map[string]string      `cty:"tags" hcl:"tags,optional" json:"tags,omitempty"`
	Maintainer       *User                  `cty:"maintainer" hcl:"maintainer,block" json:"maintainer,omitempty"`
	OnConflict       *OnConflict            `cty:"on_conflict" hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Provisioners     []Provisioner          `json:"-"`
	Caller           Caller                 `json:"-"`
	Scripts          map[string]*Script     `json:"-"`
	Commands         map[string]*Command    `json:"-"`
	RemoteFiles      map[string]*RemoteFile `json:"-"`
	DNSRecords       map[string]*DNSRecord  `json:"-"`
}

Host defines a configurable type for customizing host parameters within the infrastructure.

func (*Host) Base

func (h *Host) Base() string

Base implements the Pather interface

func (*Host) CalcIP

func (h *Host) CalcIP(subnet string) string

CalcIP is used to calculate the IP of a host within a given subnet

func (*Host) DependencyCount

func (h *Host) DependencyCount(e *Environment) int

DependencyCount is a helper function used to aggregate the number of dependencies a host has recursively

func (*Host) FinalStepID

func (h *Host) FinalStepID() int

FinalStepID gets the final step ID for a host's offset

func (*Host) Fullpath

func (h *Host) Fullpath() string

Fullpath implements the Pather interface

func (*Host) Gather

func (h *Host) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Host) GetCaller

func (h *Host) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Host) GetDependencyHash

func (h *Host) GetDependencyHash() string

GetDependencyHash returns the host's dependency hash

func (*Host) GetOnConflict

func (h *Host) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Host) GetProvisionersHash

func (h *Host) GetProvisionersHash() uint64

GetProvisionersHash returns a concatinated string of the host's provisioners hashes

func (*Host) HasTag

func (h *Host) HasTag(tag string) bool

HasTag is a template helper function to return true/false if the host contains a tag of a specific key

func (*Host) Hash

func (h *Host) Hash() uint64

Hash implements the Hasher interface

func (*Host) Index

func (h *Host) Index(base *Laforge) error

Index attempts to index all children dependencies of this type

func (*Host) IsWindows

func (h *Host) IsWindows() bool

IsWindows is a template helper function to determine if the underlying operating system is windows

func (*Host) LaforgeID

func (h *Host) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Host) MarshalEasyJSON

func (v Host) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Host) MarshalJSON

func (v Host) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Host) ParentLaforgeID

func (h *Host) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*Host) Path

func (h *Host) Path() string

Path implements the Pather interface

func (*Host) SetCaller

func (h *Host) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*Host) SetOnConflict

func (h *Host) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Host) Swap

func (h *Host) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Host) TagEquals

func (h *Host) TagEquals(tag, value string) bool

TagEquals is a template helper function to return true/false if the host contains a tag key of a specific value

func (*Host) UnmarshalEasyJSON

func (v *Host) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Host) UnmarshalJSON

func (v *Host) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Host) ValidatePath

func (h *Host) ValidatePath() error

ValidatePath implements the Pather interface

type HostDependency

type HostDependency struct {
	HostID     string      `cty:"host" hcl:"host,attr" json:"host,omitempty"`
	NetworkID  string      `cty:"network" hcl:"network,attr" json:"network,omitempty"`
	Step       string      `cty:"step" hcl:"step,optional" json:"step,omitempty"`
	StepID     int         `cty:"step_id" hcl:"step_id,optional" json:"step_id,omitempty"`
	OnConflict *OnConflict `cty:"on_conflict" hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Host       *Host       `json:"-"`
	Network    *Network    `json:"-"`
}

HostDependency is a configurable type for defining host or network dependencies to allow a dependency graph to be honored during deployment

func (*HostDependency) Hash

func (h *HostDependency) Hash() uint64

Hash implements the Hasher interface

func (HostDependency) MarshalEasyJSON

func (v HostDependency) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (HostDependency) MarshalJSON

func (v HostDependency) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*HostDependency) UnmarshalEasyJSON

func (v *HostDependency) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*HostDependency) UnmarshalJSON

func (v *HostDependency) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type IO

type IO struct {
	Stdin  string `cty:"stdin" hcl:"stdin,optional" json:"stdin,omitempty"`
	Stdout string `cty:"stdout" hcl:"stdout,optional" json:"stdout,omitempty"`
	Stderr string `cty:"stderr" hcl:"stderr,optional" json:"stderr,omitempty"`
}

IO represents a configuration type to define file locations for Stdin, Stdout, Stderr

func (IO) MarshalEasyJSON

func (v IO) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (IO) MarshalJSON

func (v IO) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*IO) UnmarshalEasyJSON

func (v *IO) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*IO) UnmarshalJSON

func (v *IO) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Identity

type Identity struct {
	ID          string            `hcl:"id,label" json:"id,omitempty"`
	Firstname   string            `hcl:"firstname,attr" json:"firstname,omitempty"`
	Lastname    string            `hcl:"lastname,attr" json:"lastname,omitempty"`
	Email       string            `hcl:"email,attr" json:"email,omitempty"`
	Password    string            `hcl:"password,attr" json:"password,omitempty"`
	Description string            `hcl:"description,optional" json:"description,omitempty"`
	AvatarFile  string            `hcl:"avatar_file,optional" json:"avatar_file,omitempty"`
	Vars        map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags        map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	OnConflict  *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Caller      Caller            `json:"-"`
}

Identity defines a generic human identity primative that can be extended into Employee, Customer, Client, etc.

func (*Identity) Base

func (i *Identity) Base() string

Base implements the Pather interface

func (*Identity) GetCaller

func (i *Identity) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Identity) GetOnConflict

func (i *Identity) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Identity) Hash

func (i *Identity) Hash() uint64

Hash implements the Hasher interface

func (*Identity) LaforgeID

func (i *Identity) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Identity) MarshalEasyJSON

func (v Identity) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Identity) MarshalJSON

func (v Identity) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Identity) Path

func (i *Identity) Path() string

Path implements the Pather interface

func (*Identity) ResolveSource

func (i *Identity) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error

ResolveSource attempts to locate the referenced source file with a laforge base configuration

func (*Identity) SetCaller

func (i *Identity) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*Identity) SetOnConflict

func (i *Identity) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Identity) Swap

func (i *Identity) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Identity) UnmarshalEasyJSON

func (v *Identity) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Identity) UnmarshalJSON

func (v *Identity) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Identity) ValidatePath

func (i *Identity) ValidatePath() error

ValidatePath implements the Pather interface

type Include

type Include struct {
	Path string `hcl:"path,attr" json:"path,omitempty"`
}

Include defines a named include type

func (Include) MarshalEasyJSON

func (v Include) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Include) MarshalJSON

func (v Include) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Include) UnmarshalEasyJSON

func (v *Include) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Include) UnmarshalJSON

func (v *Include) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type IncludedNetwork

type IncludedNetwork struct {
	Name  string   `hcl:"name,label" json:"name,omitempty"`
	Hosts []string `hcl:"included_hosts,attr" json:"included_hosts,omitempty"`
}

IncludedNetwork is a configuration type used to parse included_hosts out of an environment config.

func (IncludedNetwork) MarshalEasyJSON

func (v IncludedNetwork) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (IncludedNetwork) MarshalJSON

func (v IncludedNetwork) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*IncludedNetwork) String

func (i *IncludedNetwork) String() string

String implments the Stringer interface

func (*IncludedNetwork) UnmarshalEasyJSON

func (v *IncludedNetwork) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*IncludedNetwork) UnmarshalJSON

func (v *IncludedNetwork) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type JobStatus

type JobStatus int

JobStatus defines what state the job is in

const (
	// JobStatusPlanned is the default assignment given to jobs
	JobStatusPlanned JobStatus = iota

	// JobStatusEnqueued is assigned when the job has been put on the channel for work
	JobStatusEnqueued

	// JobStatusInProgress is assigned when the job has been picked up off the channel and is being worked
	JobStatusInProgress

	// JobStatusFailed is assigned when the job status has failed to continue
	JobStatusFailed

	// JobStatusSuccessful is assigned when the job completed successfully
	JobStatusSuccessful
)

type LFType

type LFType string

LFType describes a string representation of elements in Laforge

const (
	// LFTypeCompetition is a constant to define object type when serialized
	LFTypeCompetition LFType = `competition`

	// LFTypeNetwork is a constant to define object type when serialized
	LFTypeNetwork LFType = `network`

	// LFTypeHost is a constant to define object type when serialized
	LFTypeHost LFType = `host`

	// LFTypeRemoteFile is a constant to define object type when serialized
	LFTypeRemoteFile LFType = `remote_file`

	// LFTypeCommand is a constant to define object type when serialized
	LFTypeCommand LFType = `command`

	// LFTypeDNSRecord is a constant to define object type when serialized
	LFTypeDNSRecord LFType = `dns_record`

	// LFTypeScript is a constant to define object type when serialized
	LFTypeScript LFType = `script`

	// LFTypeEnvironment is a constant to define object type when serialized
	LFTypeEnvironment LFType = `environment`

	// LFTypeBuild is a constant to define object type when serialized
	LFTypeBuild LFType = `build`

	// LFTypeTeam is a constant to define object type when serialized
	LFTypeTeam LFType = `team`

	// LFTypeProvisionedNetwork is a constant to define object type when serialized
	LFTypeProvisionedNetwork LFType = `provisioned_network`

	// LFTypeProvisionedHost is a constant to define object type when serialized
	LFTypeProvisionedHost LFType = `provisioned_host`

	// LFTypeConnection is a constant to define object type when serialized
	LFTypeConnection LFType = `connection`

	// LFTypeProvisioningStep is a constant to define object type when serialized
	LFTypeProvisioningStep LFType = `provisioning_step`

	// LFTypeUnknown is totally a fucker
	LFTypeUnknown LFType = "unknown"
)

func TypeByPath

func TypeByPath(p string) LFType

TypeByPath attempts to resolve what type the object is based on it's ID schema

type Laforge

type Laforge struct {
	Filename                   string                         `json:"filename"`
	Includes                   []string                       `json:"-"`
	DependencyGraph            treeprint.Tree                 `json:"-"`
	CurrDir                    string                         `json:"-"`
	BaseDir                    string                         `hcl:"base_dir,optional" json:"base_dir,omitempty"`
	User                       *User                          `hcl:"user,block" json:"user,omitempty"`
	IncludePaths               []*Include                     `hcl:"include,block" json:"include_paths,omitempty"`
	DefinedCompetitions        []*Competition                 `hcl:"competition,block" json:"competitions,omitempty"`
	DefinedHosts               []*Host                        `hcl:"host,block" json:"hosts,omitempty"`
	DefinedNetworks            []*Network                     `hcl:"network,block" json:"networks,omitempty"`
	DefinedIdentities          []*Identity                    `hcl:"identity,block" json:"identities,omitempty"`
	DefinedScripts             []*Script                      `hcl:"script,block" json:"scripts,omitempty"`
	DefinedCommands            []*Command                     `hcl:"command,block" json:"defined_commands,omitempty"`
	DefinedRemoteFiles         []*RemoteFile                  `hcl:"remote_file,block" json:"defined_files,omitempty"`
	DefinedDNSRecords          []*DNSRecord                   `hcl:"dns_record,block" json:"defined_dns_records,omitempty"`
	DefinedEnvironments        []*Environment                 `hcl:"environment,block" json:"environments,omitempty"`
	DefinedBuilds              []*Build                       `hcl:"build,block" json:"builds,omitempty"`
	DefinedTeams               []*Team                        `hcl:"team,block" json:"teams,omitempty"`
	DefinedProvisionedNetworks []*ProvisionedNetwork          `hcl:"provisioned_network,block" json:"provisioned_networks,omitempty"`
	DefinedProvisionedHosts    []*ProvisionedHost             `hcl:"provisioned_host,block" json:"provisioned_hosts,omitempty"`
	DefinedProvisioningSteps   []*ProvisioningStep            `hcl:"provisioning_step,block" json:"provisioning_steps,omitempty"`
	DefinedConnections         []*Connection                  `hcl:"connection,block" json:"connections,omitempty"`
	Hosts                      map[string]*Host               `json:"-"`
	Networks                   map[string]*Network            `json:"-"`
	Identities                 map[string]*Identity           `json:"-"`
	Scripts                    map[string]*Script             `json:"-"`
	Commands                   map[string]*Command            `json:"-"`
	RemoteFiles                map[string]*RemoteFile         `json:"-"`
	DNSRecords                 map[string]*DNSRecord          `json:"-"`
	Competitions               map[string]*Competition        `json:"-"`
	Environments               map[string]*Environment        `json:"-"`
	Builds                     map[string]*Build              `json:"-"`
	Teams                      map[string]*Team               `json:"-"`
	ProvisionedNetworks        map[string]*ProvisionedNetwork `json:"-"`
	ProvisionedHosts           map[string]*ProvisionedHost    `json:"-"`
	ProvisioningSteps          map[string]*ProvisioningStep   `json:"-"`
	Connections                map[string]*Connection         `json:"-"`
	Caller                     Caller                         `json:"-"`
	ValidTeam                  bool                           `json:"-"`
	ValidBuild                 bool                           `json:"-"`
	ValidEnv                   bool                           `json:"-"`
	ValidBase                  bool                           `json:"-"`
	ValidGlobal                bool                           `json:"-"`
	ClearToBuild               bool                           `json:"-"`
	TeamRoot                   string                         `json:"-"`
	BuildRoot                  string                         `json:"-"`
	EnvRoot                    string                         `json:"-"`
	BaseRoot                   string                         `json:"-"`
	GlobalRoot                 string                         `json:"-"`
	TeamAbsPath                string                         `json:"-"`
	BuildAbsPath               string                         `json:"-"`
	EnvAbsPath                 string                         `json:"-"`
	BaseAbsPath                string                         `json:"-"`
	TeamContextID              string                         `json:"-"`
	BuildContextID             string                         `json:"-"`
	EnvContextID               string                         `json:"-"`
	BaseContextID              string                         `json:"-"`
	GlobalContextID            string                         `json:"-"`
	CurrentEnv                 *Environment                   `json:"-"`
	CurrentBuild               *Build                         `json:"-"`
	CurrentTeam                *Team                          `json:"-"`
	CurrentCompetition         *Competition                   `json:"-"`
	StateManager               *State                         `json:"-"`
	InitialContext             StateContext                   `json:"-"`
	PathRegistry               *PathRegistry                  `json:"-"`
}

Laforge defines the type that holds the global namespace within the laforge configuration engine

func Bootstrap

func Bootstrap() (*Laforge, error)

Bootstrap performs a full lifecycle bootstrap of the laforge state in a context aware way.

func InitializeBaseContext

func InitializeBaseContext(globalconfig, baseconfig string) (*Laforge, error)

InitializeBaseContext returns a base context preset with a base focused configuration

func InitializeBuildContext

func InitializeBuildContext(globalconfig, buildconfig string) (*Laforge, error)

InitializeBuildContext returns a base context preset with a build context configuration

func InitializeEnvContext

func InitializeEnvContext(globalconfig, envconfig string) (*Laforge, error)

InitializeEnvContext returns a base context preset with a env focused configuration

func InitializeTeamContext

func InitializeTeamContext(globalconfig, buildconfig, teamconfig string) (*Laforge, error)

InitializeTeamContext returns a base context preset with a team context configuration

func LoadFiles

func LoadFiles(envpath ...string) (*Laforge, error)

LoadFiles loads a configuration from configuration files passed to it

func Mask

func Mask(base, layer *Laforge) (*Laforge, error)

Mask attempts to apply a differential update betweeen base and layer, returning a modified base and any errors it encountered.

func (*Laforge) AssertExactContext

func (l *Laforge) AssertExactContext(s StateContext) error

AssertExactContext allows a program to assert a required context and fail gracefully

func (*Laforge) AssertMinContext

func (l *Laforge) AssertMinContext(s StateContext) error

AssertMinContext allows a program to assert a required context and fail gracefully

func (*Laforge) BaseConfigFile

func (l *Laforge) BaseConfigFile() string

BaseConfigFile is a helper method for creating an absolute path to the base configuration file

func (*Laforge) BuildConfigFile

func (l *Laforge) BuildConfigFile() string

BuildConfigFile is a helper method for creating an absolute path to the build results file

func (*Laforge) CleanBuildDirectory

func (l *Laforge) CleanBuildDirectory(overwrite bool) error

CleanBuildDirectory attempts to purge the current environment context's build directory (rm -r basically)

func (*Laforge) CreateIndex

func (l *Laforge) CreateIndex()

CreateIndex maps out all of the known networks, identities, scripts, commands, and hosts within a laforge configuration snapshot.

func (*Laforge) CurrentStateManager

func (l *Laforge) CurrentStateManager() (*State, error)

CurrentStateManager attempts to return the current state manager, throwing an error if it doesn't exist

func (*Laforge) EnvConfigFile

func (l *Laforge) EnvConfigFile() string

EnvConfigFile is a helper method for creating an absolute path to the environment configuration file

func (*Laforge) GetAllEnvs

func (l *Laforge) GetAllEnvs() (map[string]*Laforge, error)

GetAllEnvs recursively traverses the BaseRoot/envs/ folder looking for valid environments.

func (*Laforge) GetContext

func (l *Laforge) GetContext() StateContext

GetContext returns the current state's context

func (*Laforge) GlobalConfigFile

func (l *Laforge) GlobalConfigFile() string

GlobalConfigFile is a helper method for creating an absolute path to the global configuration file

func (*Laforge) IdentitiesWithVarEquals

func (l *Laforge) IdentitiesWithVarEquals(key, value string) []*Identity

IdentitiesWithVarEquals allows you to retrieve all identites who var key matches value

func (*Laforge) IndexBuildDependencies

func (l *Laforge) IndexBuildDependencies() error

IndexBuildDependencies enumerates all known builds and ensures it has competition and environment associations

func (*Laforge) IndexConnectionDependencies

func (l *Laforge) IndexConnectionDependencies() error

IndexConnectionDependencies enumerates all known connections and ensures they have proper associations

func (*Laforge) IndexEnvironmentDependencies

func (l *Laforge) IndexEnvironmentDependencies() error

IndexEnvironmentDependencies enumerates all known environments and makes sure they have valid network inclusions

func (*Laforge) IndexHostDependencies

func (l *Laforge) IndexHostDependencies() error

IndexHostDependencies enumerates all Host objects in the state and indexes their dependencies, reporting errors

func (*Laforge) IndexProvisionedHostDependencies

func (l *Laforge) IndexProvisionedHostDependencies() error

IndexProvisionedHostDependencies enumerates all known provisioned hosts and ensures they have proper associations

func (*Laforge) IndexProvisionedNetworkDependencies

func (l *Laforge) IndexProvisionedNetworkDependencies() error

IndexProvisionedNetworkDependencies enumerates all known provisioned networks and ensures they have proper associations

func (*Laforge) IndexProvisioningStepDependencies

func (l *Laforge) IndexProvisioningStepDependencies() error

IndexProvisioningStepDependencies enumerates all known provisioning steps and ensures they have proper associations

func (*Laforge) IndexTeamDependencies

func (l *Laforge) IndexTeamDependencies() error

IndexTeamDependencies enumerates all known teams and ensures they have proper associations

func (*Laforge) InitializeBaseDirectory

func (l *Laforge) InitializeBaseDirectory(overwrite bool) error

InitializeBaseDirectory configures a skeleton competition repository in the caller's current directory

func (*Laforge) InitializeContext

func (l *Laforge) InitializeContext() error

InitializeContext attempts to resolve the current state context from path traversal

func (*Laforge) InitializeEnv

func (l *Laforge) InitializeEnv(name string, overwrite bool) error

InitializeEnv attempts to initialize a new environment of a given name

func (*Laforge) LoadFromContext

func (l *Laforge) LoadFromContext() error

LoadFromContext attempts to bootstrap the given state from it's assumed Context Level

func (Laforge) MarshalEasyJSON

func (v Laforge) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Laforge) MarshalJSON

func (v Laforge) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Laforge) TeamConfigFile

func (l *Laforge) TeamConfigFile() string

TeamConfigFile is a helper method for creating an absolute path to the build results file

func (*Laforge) UniqIdentityVarValues

func (l *Laforge) UniqIdentityVarValues(key string) []string

UniqIdentityVarValues allows you to gather unique var values from within identities

func (*Laforge) UnmarshalEasyJSON

func (v *Laforge) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Laforge) UnmarshalJSON

func (v *Laforge) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Laforge) Update

func (l *Laforge) Update(diff *Laforge) (*Laforge, error)

Update performs a patching operation on source (l) with diff (diff), using the diff's merge conflict settings as appropriate.

type Loader

type Loader struct {
	// Parser is the actual HCLv2 parser
	Parser *hcl2parse.Parser

	// SourceFile is the location of the first file loaded
	SourceFile string

	// ConfigMap contains all the configuration steps
	ConfigMap map[string]*Laforge

	// CallerMap contains a reference of what files call what other files
	CallerMap map[string]Caller

	// Includes is a map of the dependency graph
	Includes treeprint.Tree

	// FileTree is used to map various parts of the call field
	FileTree map[string]treeprint.Tree
}

Loader defines the Laforge configuration loader object

func NewLoader

func NewLoader() *Loader

NewLoader returns a default Loader type

func (*Loader) AddToTree

func (l *Loader) AddToTree(filename, parentname string) treeprint.Tree

AddToTree effectively tracks the filetree as it grows from dependencies for the Loader

func (*Loader) Bind

func (l *Loader) Bind() (*Laforge, error)

Bind enumerates the Loader's original file, performing recursive include loads to the Loader, generating ASTs for each dependency. Bind finishes with a call to Deconflict().

func (*Loader) Deconflict

func (l *Loader) Deconflict(filenames []string) (*Laforge, error)

Deconflict attempts to perform a state differential on all referenced files by traversing the config files in LIFO order.

func (*Loader) ParseConfigFile

func (l *Loader) ParseConfigFile(filename string) error

ParseConfigFile loads a root file into Loader

type Local

type Local struct {
	OS   string
	Arch string
}

Local is used to represent information about the current runtime to the user

func (*Local) IsLinux

func (l *Local) IsLinux() bool

IsLinux is a template helper function

func (*Local) IsMacOS

func (l *Local) IsMacOS() bool

IsMacOS is a template helper function

func (*Local) IsWindows

func (l *Local) IsWindows() bool

IsWindows is a template helper function

type LocalFileRef

type LocalFileRef struct {
	Base          string `json:"base,omitempty"`
	AbsPath       string `json:"abs_path,omitempty"`
	RelPath       string `json:"rel_path,omitempty"`
	Cwd           string `json:"cwd,omitempty"`
	DeclaredPath  string `json:"declared_path,omitempty"`
	RelToCallFile string `json:"rel_to_call_file,omitempty"`
}

LocalFileRef is a basic type to hold information about a resolved file that was declared inside a state declaration

func (LocalFileRef) MarshalEasyJSON

func (v LocalFileRef) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LocalFileRef) MarshalJSON

func (v LocalFileRef) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LocalFileRef) UnmarshalEasyJSON

func (v *LocalFileRef) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LocalFileRef) UnmarshalJSON

func (v *LocalFileRef) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Manager

type Manager struct {
	Acks     chan Doer
	Errors   chan error
	Shutdown chan bool
	Inbound  chan Doer
	Laforge  *Laforge
}

Manager is a looped processor of tasks by the state machine

type Mergeable

type Mergeable interface {
	// GetCaller retrieves the object's Caller value
	GetCaller() Caller

	// LaforgeID retrieves the object's ID value
	LaforgeID() string

	// GetOnConflict retrieves the object's OnConflict value
	GetOnConflict() OnConflict

	// SetCaller sets the object's Caller to a new version
	SetCaller(ca Caller)

	// SetOnConflict replaces the object's OnConflict with a new version
	SetOnConflict(oc OnConflict)

	// Swap attempts to replace the pointer references of two mergeable objects
	Swap(ma Mergeable) error
}

Mergeable is an interface that allows for dynamic types to be merged with coordinated strategies

func SmartMerge

func SmartMerge(m, diff Mergeable, appendSlices bool) (Mergeable, error)

SmartMerge takes a source object (m) and a delta (diff) and attempts to merge them using settings based on the delta's OnConflict configuration.

type MetaResource

type MetaResource struct {
	ID           string    `json:"id,omitempty"`
	PathFromBase string    `json:"path_from_base,omitempty"`
	Basename     string    `json:"basename,omitempty"`
	ParentIDs    []string  `json:"parent_ids,omitempty"`
	IsDir        bool      `json:"is_dir,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	ModifiedAt   time.Time `json:"modified_at,omitempty"`
	Checksum     uint64    `json:"checksum,omitempty"`
	Size         int       `json:"size,omitempty"`
}

MetaResource stores information about a local file dependency. This can be a directory. If the resource is a directory, it will be recursively gzip'd and that will be checksum'd. If the resource is a directory, size will be the size of the final gzip file. Note creation and modification date refer to meta resource validation, not the actual file.

func (MetaResource) MarshalEasyJSON

func (v MetaResource) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MetaResource) MarshalJSON

func (v MetaResource) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MetaResource) UnmarshalEasyJSON

func (v *MetaResource) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MetaResource) UnmarshalJSON

func (v *MetaResource) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Metadata

type Metadata struct {
	Dependency Dependency     `json:"-"`
	ID         string         `json:"id"`
	ObjectType LFType         `json:"object_type"`
	Created    bool           `json:"provisioned,omitempty"`
	Tainted    bool           `json:"tainted,omitempty"`
	Addition   bool           `json:"addition,omitempty"`
	Checksum   uint64         `json:"checksum,omitempty"`
	CreatedAt  time.Time      `json:"created_at,omitempty"`
	ModifiedAt time.Time      `json:"modified_at,omitempty"`
	Resources  []MetaResource `json:"resources,omitempty"`
}

Metadata stores metadata about different structs within the environment

func (*Metadata) CalculateChecksum

func (m *Metadata) CalculateChecksum()

CalculateChecksum assigns the metadata object's checksum field with the dependency's hash

func (*Metadata) DotNode

func (m *Metadata) DotNode(s string, d *dag.DotOpts) *dag.DotNode

DotNode implements the DotNodder interface

func (*Metadata) FillColor

func (m *Metadata) FillColor() string

FillColor implements the DotNode interface

func (*Metadata) GetChecksum

func (m *Metadata) GetChecksum() uint64

GetChecksum implements the DotNode interface

func (*Metadata) GetID

func (m *Metadata) GetID() string

GetID implements the DotNode interface

func (*Metadata) Hash

func (m *Metadata) Hash() uint64

Hash implements the hasher interface

func (*Metadata) Hashcode

func (m *Metadata) Hashcode() interface{}

Hashcode implements the Hashable interface

func (*Metadata) IsGlobalType

func (m *Metadata) IsGlobalType() bool

IsGlobalType is a helper function specifically for metadata to call IsGlobalType easily

func (*Metadata) Label

func (m *Metadata) Label() string

Label implements the DotNode interface

func (Metadata) MarshalEasyJSON

func (v Metadata) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Metadata) MarshalJSON

func (v Metadata) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Metadata) Shape

func (m *Metadata) Shape() string

Shape implements the DotNode interface

func (*Metadata) String

func (m *Metadata) String() string

String implements the stringer interface

func (*Metadata) Style

func (m *Metadata) Style() string

Style implements the DotNode interface

func (*Metadata) ToRevision

func (m *Metadata) ToRevision() *Revision

ToRevision generates a revision object for m

func (*Metadata) TypeByPath

func (m *Metadata) TypeByPath() LFType

TypeByPath is a helper function specifically for metadata to call TypeByPath easily

func (*Metadata) UnmarshalEasyJSON

func (v *Metadata) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Metadata) UnmarshalJSON

func (v *Metadata) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Network

type Network struct {
	ID         string            `hcl:"id,label" json:"id,omitempty"`
	Name       string            `hcl:"name,attr" json:"name,omitempty"`
	CIDR       string            `hcl:"cidr,attr" json:"cidr,omitempty"`
	VDIVisible bool              `hcl:"vdi_visible,optional" json:"vdi_visible,omitempty"`
	Vars       map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags       map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	OnConflict *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Caller     Caller            `json:"-"`
}

Network defines a network within a competition environment

func (*Network) Base

func (n *Network) Base() string

Base implements the Pather interface

func (*Network) Gather

func (n *Network) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Network) GetCaller

func (n *Network) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Network) GetOnConflict

func (n *Network) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Network) Hash

func (n *Network) Hash() uint64

Hash implements the Hasher interface

func (*Network) LaforgeID

func (n *Network) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Network) MarshalEasyJSON

func (v Network) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Network) MarshalJSON

func (v Network) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Network) Octet

func (n *Network) Octet() string

Octet is a template helper function to get a network's octet at a specified offset

func (*Network) ParentLaforgeID

func (n *Network) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*Network) Path

func (n *Network) Path() string

Path implements the Pather interface

func (*Network) SetCaller

func (n *Network) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*Network) SetOnConflict

func (n *Network) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Network) Swap

func (n *Network) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Network) UnmarshalEasyJSON

func (v *Network) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Network) UnmarshalJSON

func (v *Network) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Network) ValidatePath

func (n *Network) ValidatePath() error

ValidatePath implements the Pather interface

type OnConflict

type OnConflict struct {
	Do     string `cty:"do" hcl:"do,attr" json:"do,omitempty"`
	Append bool   `cty:"append" hcl:"append,optional" json:"append,omitempty"`
}

OnConflict defines a configuration override for how to handle conflicting objects in the differential enumeration of objects. For example, if you have a file that has loaded a host definition (host "foo" {...}) and you have included an additional configuration in your env.laforge, you can specify an on_conflict { do = "" } setting within your block to control how the state of host "foo" has state changes applied to it.

host "foo" {
	on_conflict {
		do = "overwrite"
	}
}

The default behavior (no on_conflict block) is to perform an overriding MERGE on the original object with your changes. Think of this as updating only fields you have defined and are non-zero. If you wish to specify a different strategy, the following ones are valid:

  • "overwrite" will replace the entirety of original "foo" with your definition, discarding any previous state.
  • "inherit" will apply a merge in reverse - merging the original "foo" into your definition, overwriting any fields.
  • "panic" will raise a runtime error and prevent further execution. This can be a very helpful way to avoid state on "root" definitions.

func (OnConflict) MarshalEasyJSON

func (v OnConflict) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OnConflict) MarshalJSON

func (v OnConflict) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OnConflict) UnmarshalEasyJSON

func (v *OnConflict) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OnConflict) UnmarshalJSON

func (v *OnConflict) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Opt

type Opt struct {
	Key   string `hcl:",label" json:"key,omitempty"`
	Value string `hcl:"value,attr" json:"value,omitempty"`
}

Opt defines a basic HCLv2 option label:

config "keyName" {
	value = "valueData"
}

func (Opt) MarshalEasyJSON

func (v Opt) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Opt) MarshalJSON

func (v Opt) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Opt) UnmarshalEasyJSON

func (v *Opt) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Opt) UnmarshalJSON

func (v *Opt) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OutputCallback

type OutputCallback func(state *State, job Doer, line string) error

OutputCallback is used to monitor the output of terraform as it runs

type PathRegistry

type PathRegistry struct {
	DB map[CallFile]*PathResolver // key = composite of $type.$id, value = PathResolver
}

PathRegistry is a type that tracks the relative file paths of state configurations that include external sources

type PathResolver

type PathResolver struct {
	Mapping    map[string]*LocalFileRef // map[provided_path_declaration] => LocalFileRef
	Unresolved map[string]bool          // map[provided_path_declaration] => true when we can't resolve it
}

PathResolver defines the mapping of paths declared in a CallFile and their mapping to files on local disk or lack of resolution

type Pather

type Pather interface {
	Path() string
	Base() string
	ValidatePath() error
}

Pather is an interface to define hosts which need to conform to valid pathing schemes

type Plan

type Plan struct {
	TaskGroundDelay   int               `json:"ground_delay"`
	Base              *Laforge          `json:"-"`
	Checksum          uint64            `json:"checksum"`
	StartedAt         time.Time         `json:"started_at"`
	EndedAt           time.Time         `json:"ended_at"`
	Graph             *Snapshot         `json:"target,omitempty"`
	TaskTypes         map[string]string `json:"task_types"`
	Tasks             map[string]Doer   `json:"-"`
	TasksByPriority   map[int][]string  `json:"tasks_by_priority"`
	GlobalOrder       []string          `json:"global_order"`
	OrderedPriorities []int             `json:"ordered_priorities"`
	Tainted           map[string]bool   `json:"tainted"`
	TaintedHosts      map[string]bool   `json:"tainted_hosts"`
	Walker            *dag.Walker       `json:"-"`
	Errored           bool              `json:"-"`
	FailedNodes       *dag.Set          `json:"-"`
}

Plan is a type that describes how to get from one state to the next

func NewEmptyPlan

func NewEmptyPlan() *Plan

NewEmptyPlan returns an initialized, but empty plan object.

func (*Plan) BurnIt

func (p *Plan) BurnIt() error

BurnIt is the stub for destroying all terraform environments and their dependencies

func (*Plan) Execute

func (p *Plan) Execute() tfdiags.Diagnostics

Execute walks the plan's functions against the computed dependency graph

func (Plan) MarshalEasyJSON

func (v Plan) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Plan) MarshalJSON

func (v Plan) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Plan) Orchestrator

func (p *Plan) Orchestrator(v dag.Vertex) (d tfdiags.Diagnostics)

Orchestrator is the walk function that is executed for each path in the dependency graph

func (*Plan) Preflight

func (p *Plan) Preflight() error

Preflight determines what teams need terraform run on them, executing them before the plan

func (*Plan) RemoveRevisionFilesFromTeams

func (p *Plan) RemoveRevisionFilesFromTeams() error

RemoveRevisionFilesFromTeams walks the team directory in the current build and removes them

func (*Plan) SetupTasks

func (p *Plan) SetupTasks() error

SetupTasks attempts to cull the Tasks map with Doer types to actually be performed

func (*Plan) UnmarshalEasyJSON

func (v *Plan) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Plan) UnmarshalJSON

func (v *Plan) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Plan) WriteRevisionFile

func (p *Plan) WriteRevisionFile(d Doer, status RevStatus) error

WriteRevisionFile writes a deng revision file

type ProvisionStatus

type ProvisionStatus string

ProvisionStatus describes components of a provisioned environment and the various states they're in

const (
	// ProvStatusUndefined represents an empty provision state
	ProvStatusUndefined ProvisionStatus = ""

	// ProvStatusAwaiting represents a provisionable object that has been indexed, but not implemented
	ProvStatusAwaiting ProvisionStatus = "AWAITING"

	// ProvStatusInProgress represents a provisioanble object that has been indexed ans is in the process of being implemented.
	ProvStatusInProgress ProvisionStatus = "INPROGRESS"

	// ProvStatusFailed represents a provisioanble object that failed during it's implementation.
	ProvStatusFailed ProvisionStatus = "FAILED"

	// ProvStatusComplete represents a provisionable object that has successfully been implemented.
	ProvStatusComplete ProvisionStatus = "COMPLETE"

	// ProvStatusTainted represents a provisionable object that has been implemented, but is marked for re-implementation.
	ProvStatusTainted ProvisionStatus = "TAINTED"
)

type ProvisionedHost

type ProvisionedHost struct {
	ID                 string                       `hcl:"id,label" json:"id,omitempty"`
	HostID             string                       `hcl:"host_id,attr" json:"host_id,omitempty"`
	SubnetIP           string                       `hcl:"subnet_ip,attr" json:"subnet_ip,omitempty"`
	Conn               *Connection                  `hcl:"connection,block" json:"connection"`
	Status             Status                       `hcl:"status,optional" json:"status"`
	ProvisioningSteps  map[string]*ProvisioningStep `json:"provisioning_steps"`
	StepsByOffset      []*ProvisioningStep          `json:"-"`
	ProvisionedNetwork *ProvisionedNetwork          `json:"-"`
	Team               *Team                        `json:"-"`
	Build              *Build                       `json:"-"`
	Environment        *Environment                 `json:"-"`
	Competition        *Competition                 `json:"-"`
	Network            *Network                     `json:"-"`
	Host               *Host                        `json:"-"`
	OnConflict         *OnConflict                  `json:"-"`
	Caller             Caller                       `json:"-"`
	Dir                string                       `json:"-"`
}

ProvisionedHost is a build artifact type to denote a host inside a team's provisioend infrastructure.

func (*ProvisionedHost) ActualPassword

func (p *ProvisionedHost) ActualPassword() string

ActualPassword attempts to get everything just right interms of what the actual password of this machine is

func (*ProvisionedHost) Base

func (p *ProvisionedHost) Base() string

Base implements the Pather interface

func (*ProvisionedHost) CreateConnection

func (p *ProvisionedHost) CreateConnection() *Connection

CreateConnection creates this host's skeleton connection file to be used

func (*ProvisionedHost) CreateProvisioningStep

func (p *ProvisionedHost) CreateProvisioningStep(pr Provisioner, offset int) *ProvisioningStep

CreateProvisioningStep creates a new provisioning step object for the provisioned host, mapping parent objects.

func (*ProvisionedHost) CreateProvisioningSteps

func (p *ProvisionedHost) CreateProvisioningSteps() error

CreateProvisioningSteps enumerates all the parent Host object's provisioning steps, mapping a custom ProvisioningStep object for this provisioned host.

func (*ProvisionedHost) Gather

func (p *ProvisionedHost) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*ProvisionedHost) GetCaller

func (p *ProvisionedHost) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*ProvisionedHost) GetOnConflict

func (p *ProvisionedHost) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*ProvisionedHost) Hash

func (p *ProvisionedHost) Hash() uint64

Hash implements the Hasher interface

func (*ProvisionedHost) LaforgeID

func (p *ProvisionedHost) LaforgeID() string

LaforgeID implements the Mergeable interface This will be: /envs/$env_base/$build_base/teams/$team_base/networks/$network_base/$host_base

func (ProvisionedHost) MarshalEasyJSON

func (v ProvisionedHost) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProvisionedHost) MarshalJSON

func (v ProvisionedHost) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProvisionedHost) ParentLaforgeID

func (p *ProvisionedHost) ParentLaforgeID() string

ParentLaforgeID returns the Team's parent build ID

func (*ProvisionedHost) Path

func (p *ProvisionedHost) Path() string

Path implements the Pather interface

func (*ProvisionedHost) SetCaller

func (p *ProvisionedHost) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*ProvisionedHost) SetID

func (p *ProvisionedHost) SetID() string

SetID increments the revision and sets the team ID if needed

func (*ProvisionedHost) SetOnConflict

func (p *ProvisionedHost) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*ProvisionedHost) Swap

func (p *ProvisionedHost) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*ProvisionedHost) UnmarshalEasyJSON

func (v *ProvisionedHost) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProvisionedHost) UnmarshalJSON

func (v *ProvisionedHost) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ProvisionedHost) ValidatePath

func (p *ProvisionedHost) ValidatePath() error

ValidatePath implements the Pather interface

type ProvisionedNetwork

type ProvisionedNetwork struct {
	ID               string                      `hcl:"id,label" json:"id,omitempty"`
	Name             string                      `hcl:"name,attr" json:"name,omitempty"`
	CIDR             string                      `hcl:"cidr,attr" json:"cidr,omitempty"`
	NetworkID        string                      `hcl:"network_id,attr" json:"network_id,omitempty"`
	ProvisionedHosts map[string]*ProvisionedHost `json:"provisioned_hosts"`
	Status           Status                      `hcl:"status,optional" json:"status"`
	Network          *Network                    `json:"-"`
	Team             *Team                       `json:"-"`
	Build            *Build                      `json:"-"`
	Environment      *Environment                `json:"-"`
	Competition      *Competition                `json:"-"`
	OnConflict       *OnConflict                 `json:"-"`
	Caller           Caller                      `json:"-"`
	Dir              string                      `json:"-"`
}

ProvisionedNetwork is a build artifact type to denote a network inside a team's provisioend infrastructure.

func (*ProvisionedNetwork) Base

func (p *ProvisionedNetwork) Base() string

Base implements the Pather interface

func (*ProvisionedNetwork) CreateProvisionedHost

func (p *ProvisionedNetwork) CreateProvisionedHost(host *Host) *ProvisionedHost

CreateProvisionedHost creates the actual provisioned host object and assigns the parental objects accordingly.

func (*ProvisionedNetwork) CreateProvisionedHosts

func (p *ProvisionedNetwork) CreateProvisionedHosts() error

CreateProvisionedHosts enumerates the parent environment's host by network and creates provisioned host objects in this tree.

func (*ProvisionedNetwork) Gather

func (p *ProvisionedNetwork) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*ProvisionedNetwork) GetCaller

func (p *ProvisionedNetwork) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*ProvisionedNetwork) GetOnConflict

func (p *ProvisionedNetwork) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*ProvisionedNetwork) Hash

func (p *ProvisionedNetwork) Hash() uint64

Hash implements the Hasher interface

func (*ProvisionedNetwork) LaforgeID

func (p *ProvisionedNetwork) LaforgeID() string

LaforgeID implements the Mergeable interface

func (ProvisionedNetwork) MarshalEasyJSON

func (v ProvisionedNetwork) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProvisionedNetwork) MarshalJSON

func (v ProvisionedNetwork) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProvisionedNetwork) ParentLaforgeID

func (p *ProvisionedNetwork) ParentLaforgeID() string

ParentLaforgeID returns the Team's parent build ID

func (*ProvisionedNetwork) Path

func (p *ProvisionedNetwork) Path() string

Path implements the Pather interface

func (*ProvisionedNetwork) SetCaller

func (p *ProvisionedNetwork) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*ProvisionedNetwork) SetID

func (p *ProvisionedNetwork) SetID() string

SetID increments the revision and sets the team ID if needed

func (*ProvisionedNetwork) SetOnConflict

func (p *ProvisionedNetwork) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*ProvisionedNetwork) Swap

func (p *ProvisionedNetwork) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*ProvisionedNetwork) UnmarshalEasyJSON

func (v *ProvisionedNetwork) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProvisionedNetwork) UnmarshalJSON

func (v *ProvisionedNetwork) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ProvisionedNetwork) ValidatePath

func (p *ProvisionedNetwork) ValidatePath() error

ValidatePath implements the Pather interface

type Provisioner

type Provisioner interface {
	graph.Hasher
	Pather

	Gather(s *Snapshot) error
	ParentLaforgeID() string

	// Kind denotes the type of Provisioner this is
	Kind() string
}

Provisioner is a meta interface to provide provisioning steps to the Builder

type ProvisioningStep

type ProvisioningStep struct {
	ID                 string              `hcl:"id,label" json:"id,omitempty"`
	ProvisionerID      string              `hcl:"provisioner_id,attr" json:"provisioner_id,omitempty"`
	ProvisionerType    string              `hcl:"provisioner_type,attr" json:"provisioner_type,omitempty"`
	StepNumber         int                 `hcl:"step_number,attr" json:"step_number,omitempty"`
	Status             string              `hcl:"status,optional" json:"status,omitempty"`
	ProvisionedHost    *ProvisionedHost    `json:"-"`
	ProvisionedNetwork *ProvisionedNetwork `json:"-"`
	Host               *Host               `json:"-"`
	Network            *Network            `json:"-"`
	Team               *Team               `json:"-"`
	Build              *Build              `json:"-"`
	Environment        *Environment        `json:"-"`
	Competition        *Competition        `json:"-"`
	Provisioner        Provisioner         `json:"-"`
	Script             *Script             `json:"-"`
	Command            *Command            `json:"-"`
	RemoteFile         *RemoteFile         `json:"-"`
	DNSRecord          *DNSRecord          `json:"-"`
	OnConflict         *OnConflict         `json:"-"`
	Caller             Caller              `json:"-"`
	Dir                string              `json:"-"`
}

ProvisioningStep is a build artifact type to denote a specific step inside of a provisioned host

func (*ProvisioningStep) Base

func (p *ProvisioningStep) Base() string

Base implements the Pather interface

func (*ProvisioningStep) Gather

func (p *ProvisioningStep) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*ProvisioningStep) GetCaller

func (p *ProvisioningStep) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*ProvisioningStep) GetOnConflict

func (p *ProvisioningStep) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*ProvisioningStep) Hash

func (p *ProvisioningStep) Hash() uint64

Hash implements the Hasher interface

func (*ProvisioningStep) LaforgeID

func (p *ProvisioningStep) LaforgeID() string

LaforgeID implements the Mergeable interface

func (ProvisioningStep) MarshalEasyJSON

func (v ProvisioningStep) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProvisioningStep) MarshalJSON

func (v ProvisioningStep) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProvisioningStep) ParentLaforgeID

func (p *ProvisioningStep) ParentLaforgeID() string

ParentLaforgeID returns the Team's parent build ID

func (*ProvisioningStep) Path

func (p *ProvisioningStep) Path() string

Path implements the Pather interface

func (*ProvisioningStep) SetCaller

func (p *ProvisioningStep) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*ProvisioningStep) SetID

func (p *ProvisioningStep) SetID() string

SetID increments the revision and sets the team ID if needed

func (*ProvisioningStep) SetOnConflict

func (p *ProvisioningStep) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*ProvisioningStep) Swap

func (p *ProvisioningStep) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*ProvisioningStep) UnmarshalEasyJSON

func (v *ProvisioningStep) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProvisioningStep) UnmarshalJSON

func (v *ProvisioningStep) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ProvisioningStep) ValidatePath

func (p *ProvisioningStep) ValidatePath() error

ValidatePath implements the Pather interface

type RelateFunc

type RelateFunc func() error

RelateFunc is a type alias to a function that relates objects together in a promise style format

type Remote

type Remote struct {
	ID     string            `hcl:"id,label" json:"id,omitempty"`
	Type   string            `hcl:"type,attr" json:"type,omitempty"`
	Config map[string]string `hcl:"config,optional" json:"config,omitempty"`
}

Remote defines a configuration object that keeps terraform and remote files synchronized

func (*Remote) Hash

func (r *Remote) Hash() uint64

Hash implements the Hasher interface

func (Remote) MarshalEasyJSON

func (v Remote) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Remote) MarshalJSON

func (v Remote) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Remote) UnmarshalEasyJSON

func (v *Remote) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Remote) UnmarshalJSON

func (v *Remote) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RemoteCommand

type RemoteCommand struct {
	Command string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer

	sync.Mutex
	// contains filtered or unexported fields
}

RemoteCommand represents a remote command being prepared or run.

func NewRemoteCommand

func NewRemoteCommand() *RemoteCommand

NewRemoteCommand creates a new empty remote command object

func (*RemoteCommand) Init

func (r *RemoteCommand) Init()

Init must be called before executing the command.

func (*RemoteCommand) SetExitStatus

func (r *RemoteCommand) SetExitStatus(status int, err error)

SetExitStatus stores the exit status of the remote command

func (*RemoteCommand) Wait

func (r *RemoteCommand) Wait() error

Wait waits for the remote command to complete.

type RemoteFile

type RemoteFile struct {
	ID          string            `hcl:"id,label" json:"id,omitempty"`
	SourceType  string            `hcl:"source_type,attr" json:"source_type,omitempty"`
	Source      string            `hcl:"source,attr" json:"source,omitempty"`
	Destination string            `hcl:"destination,attr" json:"destination,omitempty"`
	Vars        map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags        map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	Template    bool              `hcl:"template,optional" json:"template,omitempty"`
	Perms       string            `hcl:"perms,optional" json:"perms,omitempty"`
	Disabled    bool              `hcl:"disabled,optional" json:"disabled,omitempty"`
	OnConflict  *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	MD5         string            `hcl:"md5,optional" json:"md5,omitempty"`
	Caller      Caller            `json:"-"`
	AbsPath     string            `json:"-"`
	Ext         string            `json:"-"`
}

RemoteFile is a configurable type that defines a static file that will be placed on a configured target host.

func (*RemoteFile) AssetName

func (r *RemoteFile) AssetName() (string, error)

AssetName returns the asset's name calculated as intended

func (*RemoteFile) Base

func (r *RemoteFile) Base() string

Base implements the Pather interface

func (*RemoteFile) CopyTo

func (r *RemoteFile) CopyTo(dst string) error

CopyTo copies the local file to another location on the local machine

func (*RemoteFile) Fullpath

func (r *RemoteFile) Fullpath() string

Fullpath implements the Pather interface

func (*RemoteFile) Gather

func (r *RemoteFile) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*RemoteFile) GetCaller

func (r *RemoteFile) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*RemoteFile) GetOnConflict

func (r *RemoteFile) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*RemoteFile) Hash

func (r *RemoteFile) Hash() uint64

Hash implements the Hasher interface

func (*RemoteFile) Kind

func (r *RemoteFile) Kind() string

Kind implements the Provisioner interface

func (*RemoteFile) LaforgeID

func (r *RemoteFile) LaforgeID() string

LaforgeID implements the Mergeable interface

func (*RemoteFile) MD5Sum

func (r *RemoteFile) MD5Sum() (string, error)

MD5Sum returns the MD5 checksum of a local file

func (RemoteFile) MarshalEasyJSON

func (v RemoteFile) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RemoteFile) MarshalJSON

func (v RemoteFile) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RemoteFile) ParentLaforgeID

func (r *RemoteFile) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*RemoteFile) Path

func (r *RemoteFile) Path() string

Path implements the Pather interface

func (*RemoteFile) ResolveSource

func (r *RemoteFile) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error

ResolveSource attempts to locate the referenced source file with a laforge base configuration

func (*RemoteFile) ResourceHash

func (r *RemoteFile) ResourceHash() uint64

ResourceHash implements the ResourceHasher interface

func (*RemoteFile) SetCaller

func (r *RemoteFile) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*RemoteFile) SetOnConflict

func (r *RemoteFile) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*RemoteFile) Swap

func (r *RemoteFile) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*RemoteFile) UnmarshalEasyJSON

func (v *RemoteFile) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RemoteFile) UnmarshalJSON

func (v *RemoteFile) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*RemoteFile) ValidatePath

func (r *RemoteFile) ValidatePath() error

ValidatePath implements the Pather interface

type RemoteFileJob

type RemoteFileJob struct {
	GenericJob
	Target     *ProvisioningStep `json:"-"`
	RemoteFile *RemoteFile       `json:"-"`
	AssetPath  string            `json:"asset_path,omitempty"`
}

RemoteFileJob attempts to upload a file to the remote machine easyjson:json

func CreateRemoteFileJob

func CreateRemoteFileJob(id string, offset int, m *Metadata, pstep *ProvisioningStep) (*RemoteFileJob, error)

CreateRemoteFileJob creates a new remote file job for a Doer object within the Planner

func (*RemoteFileJob) CanProceed

func (j *RemoteFileJob) CanProceed(e chan error)

CanProceed implements the Doer interface

func (*RemoteFileJob) CleanUp

func (j *RemoteFileJob) CleanUp(e chan error)

CleanUp implements the Doer interface

func (*RemoteFileJob) Do

func (j *RemoteFileJob) Do(e chan error)

Do implements the Doer interface

func (*RemoteFileJob) EnsureDependencies

func (j *RemoteFileJob) EnsureDependencies(e chan error)

EnsureDependencies implements the Doer interface

func (*RemoteFileJob) Finish

func (j *RemoteFileJob) Finish(e chan error)

Finish implements the Doer interface

func (RemoteFileJob) MarshalEasyJSON

func (v RemoteFileJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RemoteFileJob) MarshalJSON

func (v RemoteFileJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RemoteFileJob) UnmarshalEasyJSON

func (v *RemoteFileJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RemoteFileJob) UnmarshalJSON

func (v *RemoteFileJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ResourceHasher

type ResourceHasher interface {
	ResourceHash() uint64
}

ResourceHasher is an interface to define types who have file dependencies to checkum them

type RevMod

type RevMod string

RevMod is an internal type alias to label needs of objects within an environments deployment

type RevStatus

type RevStatus string

RevStatus is a type used to describe the current state of the revision

type Revision

type Revision struct {
	ID         string            `json:"id"`
	Type       LFType            `json:"type"`
	Status     RevStatus         `json:"status"`
	Checksum   uint64            `json:"checksum"`
	Timestamp  time.Time         `json:"timestamp"`
	ExternalID string            `json:"external_id"`
	Vars       map[string]string `json:"vars"`
}

Revision is used to describe a small .lfrevision file placed in the root of each path

func ParseRevisionFile

func ParseRevisionFile(fpath string) (*Revision, error)

ParseRevisionFile attempts to parse a revision file at the given location

func (*Revision) AbsPath added in v0.2.1

func (r *Revision) AbsPath(basedir string) string

AbsPath returns a joined file path for build types and below

func (*Revision) Filename added in v0.2.1

func (r *Revision) Filename() string

Filename returns the base filename of the revision file

func (Revision) MarshalEasyJSON

func (v Revision) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Revision) MarshalJSON

func (v Revision) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Revision) Taint added in v0.2.1

func (r *Revision) Taint() *Revision

Taint changes the revision to one that is a stale state

func (*Revision) ToJSONString

func (r *Revision) ToJSONString() string

ToJSONString converts the revision to a JSON string

func (*Revision) Touch

func (r *Revision) Touch() *Revision

Touch sets the current timestamp and status to active for use within templating engines

func (*Revision) TouchWithID

func (r *Revision) TouchWithID(s string) *Revision

TouchWithID touches the revision and updates it's External ID resource

func (*Revision) UnmarshalEasyJSON

func (v *Revision) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Revision) UnmarshalJSON

func (v *Revision) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SSHAuthConfig

type SSHAuthConfig struct {
	RemoteAddr      string        `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
	Port            int           `hcl:"port,attr" json:"port,omitempty"`
	User            string        `hcl:"user,attr" json:"user,omitempty"`
	Password        string        `hcl:"password,optional" json:"password,omitempty"`
	IdentityFile    string        `hcl:"identity_file,optional" json:"identity_file,omitempty"`
	IdentityFileRef *LocalFileRef `json:"-"`
}

SSHAuthConfig defines how Laforge should connect via SSH to a provisioned host

func (*SSHAuthConfig) Hash

func (s *SSHAuthConfig) Hash() uint64

Hash implements the Hasher interface

func (*SSHAuthConfig) LoadIdentityFile

func (s *SSHAuthConfig) LoadIdentityFile(base *Laforge, pr *PathResolver, caller CallFile) error

LoadIdentityFile attempts to locate the referenced source file with a laforge base configuration

func (SSHAuthConfig) MarshalEasyJSON

func (v SSHAuthConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SSHAuthConfig) MarshalJSON

func (v SSHAuthConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SSHAuthConfig) Protocol

func (s *SSHAuthConfig) Protocol() string

Protocol implements the ShellConfig interface

func (*SSHAuthConfig) UnmarshalEasyJSON

func (v *SSHAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SSHAuthConfig) UnmarshalJSON

func (v *SSHAuthConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SSHClient

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

SSHClient represents the client that connects to a remote server via SSH

func NewSSHClient

func NewSSHClient(sshconf *SSHAuthConfig, overrideKey string) (*SSHClient, error)

NewSSHClient creates a new communicator implementation over SSH.

func (*SSHClient) Connect

func (s *SSHClient) Connect() (err error)

Connect implementation of communicator.Communicator interface

func (*SSHClient) DeleteScriptV2

func (s *SSHClient) DeleteScriptV2(remotefile string) error

DeleteScriptV2 uses the 3rd party pkg/sftp Go package to securely erase a file

func (*SSHClient) Disconnect

func (s *SSHClient) Disconnect() error

Disconnect implementation of communicator.Communicator interface

func (*SSHClient) LaunchInteractiveShell

func (s *SSHClient) LaunchInteractiveShell() error

LaunchInteractiveShell launches an interactive SSH session through the terminal

func (*SSHClient) Start

func (s *SSHClient) Start(cmd *RemoteCommand) error

Start executes a remote command on the host

func (*SSHClient) Upload

func (s *SSHClient) Upload(path string, input io.Reader) error

Upload implementation of communicator.Communicator interface

func (*SSHClient) UploadDir

func (s *SSHClient) UploadDir(dst string, src string) error

UploadDir uploads a directory to the remote host

func (*SSHClient) UploadFileV2

func (s *SSHClient) UploadFileV2(src, dst string) error

UploadFileV2 uses the 3rd party pkg/sftp Go package to upload instead of native x/ssh with scp modes.

func (*SSHClient) UploadScript

func (s *SSHClient) UploadScript(path string, input io.Reader) error

UploadScript uploads a script for execution to the remote host

func (*SSHClient) UploadScriptV2

func (s *SSHClient) UploadScriptV2(src, dst string) error

UploadScriptV2 uses the 3rd party pkg/sftp Go package to upload instead of native x/ssh with scp modes.

type Script

type Script struct {
	ID           string            `hcl:"id,label" json:"id,omitempty"`
	Name         string            `hcl:"name,attr" json:"name,omitempty"`
	Language     string            `hcl:"language,attr" json:"language,omitempty"`
	Description  string            `hcl:"description,optional" json:"description,omitempty"`
	Maintainer   *User             `hcl:"maintainer,block" json:"maintainer,omitempty"`
	Source       string            `hcl:"source,attr" json:"source,omitempty"`
	SourceType   string            `hcl:"source_type,attr" json:"source_type,omitempty"`
	Cooldown     int               `hcl:"cooldown,optional" json:"cooldown,omitempty"`
	IgnoreErrors bool              `hcl:"ignore_errors,optional" json:"ignore_errors,omitempty"`
	Args         []string          `hcl:"args,optional" json:"args,omitempty"`
	IO           *IO               `hcl:"io,block" json:"io,omitempty"`
	Disabled     bool              `hcl:"disabled,optional" json:"disabled,omitempty"`
	Vars         map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
	Tags         map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
	OnConflict   *OnConflict       `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Findings     []*Finding        `hcl:"finding,block" json:"findings,omitempty"`
	AbsPath      string            `json:"-"`
	Caller       Caller            `json:"-"`
}

Script defines a configurable type for an executable script object within the laforge configuration

func (*Script) ArgString

func (s *Script) ArgString() string

ArgString is a template helper function to embed the arg string into the output

func (*Script) Base

func (s *Script) Base() string

Base implements the Pather interface

func (*Script) Fullpath

func (s *Script) Fullpath() string

Fullpath implements the Pather interface

func (*Script) Gather

func (s *Script) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Script) GetCaller

func (s *Script) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Script) GetOnConflict

func (s *Script) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Script) Hash

func (s *Script) Hash() uint64

Hash implements the Hasher interface

func (*Script) Kind

func (s *Script) Kind() string

Kind implements the Provisioner interface

func (*Script) LaforgeID

func (s *Script) LaforgeID() string

LaforgeID implements the Mergeable interface

func (Script) MarshalEasyJSON

func (v Script) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Script) MarshalJSON

func (v Script) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Script) ParentLaforgeID

func (s *Script) ParentLaforgeID() string

ParentLaforgeID implements the Dependency interface

func (*Script) Path

func (s *Script) Path() string

Path implements the Pather interface

func (*Script) ResolveSource

func (s *Script) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error

ResolveSource attempts to locate the referenced source file with a laforge base configuration

func (*Script) ResourceHash

func (s *Script) ResourceHash() uint64

ResourceHash implements the ResourceHasher interface

func (*Script) SetCaller

func (s *Script) SetCaller(c Caller)

SetCaller implements the Mergeable interface

func (*Script) SetOnConflict

func (s *Script) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Script) SourceBase

func (s *Script) SourceBase() string

SourceBase is a template helper function to return the base filename of a source script

func (*Script) Swap

func (s *Script) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Script) UnmarshalEasyJSON

func (v *Script) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Script) UnmarshalJSON

func (v *Script) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Script) ValidatePath

func (s *Script) ValidatePath() error

ValidatePath implements the Pather interface

type ScriptJob

type ScriptJob struct {
	GenericJob
	Target    *ProvisioningStep `json:"-"`
	Script    *Script           `json:"-"`
	AssetPath string            `json:"asset_path,omitempty"`
}

ScriptJob attempts to upload and execute a script on the remote system easyjson:json

func CreateScriptJob

func CreateScriptJob(id string, offset int, m *Metadata, pstep *ProvisioningStep) (*ScriptJob, error)

CreateScriptJob creates a new script job for a Doer object with the Planner

func (*ScriptJob) CanProceed

func (j *ScriptJob) CanProceed(e chan error)

CanProceed implements the Doer interface

func (*ScriptJob) CleanUp

func (j *ScriptJob) CleanUp(e chan error)

CleanUp implements the Doer interface

func (*ScriptJob) Do

func (j *ScriptJob) Do(e chan error)

Do implements the Doer interface

func (*ScriptJob) EnsureDependencies

func (j *ScriptJob) EnsureDependencies(e chan error)

EnsureDependencies implements the Doer interface

func (*ScriptJob) Finish

func (j *ScriptJob) Finish(e chan error)

Finish implements the Doer interface

func (ScriptJob) MarshalEasyJSON

func (v ScriptJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ScriptJob) MarshalJSON

func (v ScriptJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ScriptJob) UnmarshalEasyJSON

func (v *ScriptJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ScriptJob) UnmarshalJSON

func (v *ScriptJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ShellConfig

type ShellConfig interface {
	// Protocol denotes the protocol to be used
	Protocol() string
}

ShellConfig is a generic type for shell configurations

type Snapshot

type Snapshot struct {
	Checksum  uint64               `json:"checksum"`
	AltGraph  *dag.AcyclicGraph    `json:"altgraph"`
	Metastore map[string]*Metadata `json:"metadata"`
	RootID    string               `json:"root_id"`
	Edges     interface{}          `json:"edges"`
	Metabus   chan *Metadata       `json:"-"`
	Nodebus   chan *Metadata       `json:"-"`
	Edgebus   chan Edge            `json:"-"`
	Mutex     *sync.RWMutex        `json:"-"`
}

Snapshot is a graph traversal structure used to create a unique fingerprint for all elements in an environment. easyjson:json

func NewEmptySnapshot

func NewEmptySnapshot() *Snapshot

NewEmptySnapshot returns an empty snapshot object

func NewSnapshotFromEnv

func NewSnapshotFromEnv(e *Environment, overwriteBuild bool) (*Snapshot, error)

NewSnapshotFromEnv creates a new snapshot from a provided environment

func (*Snapshot) AddNodeV2

func (s *Snapshot) AddNodeV2(id string)

AddNodeV2 places items on the graph

func (*Snapshot) AddObject

func (s *Snapshot) AddObject(dep Dependency)

AddObject adds a dependency to the Metastore

func (*Snapshot) AddRelationship

func (s *Snapshot) AddRelationship(src Dependency, target Dependency)

AddRelationship places a relationship on the Edgebus

func (*Snapshot) GetEdges

func (s *Snapshot) GetEdges() mapset.Set

GetEdges returns a type asserted set of edges

func (*Snapshot) Hash

func (s *Snapshot) Hash() uint64

Hash implements the hasher interface

func (Snapshot) MarshalEasyJSON

func (v Snapshot) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Snapshot) MarshalJSON

func (v Snapshot) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Snapshot) PopulateGraph

func (s *Snapshot) PopulateGraph(end chan struct{}, fin chan struct{})

PopulateGraph places items on the graph with a default root value

func (*Snapshot) RebuildGraph

func (s *Snapshot) RebuildGraph() error

RebuildGraph will attempt to recreate the dependency tree based on it's persisted metadata instead of building from environment.

func (*Snapshot) Relate

func (s *Snapshot) Relate(root Dependency, leafs ...Dependency) error

Relate takes a root dependency, and creates associations in the graph from it to the leafs. DEPRECATED

func (*Snapshot) RelateObjects

func (s *Snapshot) RelateObjects(end chan struct{}, fin chan struct{})

RelateObjects monitors the edgebus channel for objects that need edges defined in the graph

func (*Snapshot) RelateV2

func (s *Snapshot) RelateV2(e Edge)

RelateV2 is what actually snips and splices edges into the graph

func (*Snapshot) StoreMetadata

func (s *Snapshot) StoreMetadata(end chan struct{}, fin chan struct{})

StoreMetadata creates entries in the snapshot's Metastore

func (*Snapshot) UnmarshalEasyJSON

func (v *Snapshot) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Snapshot) UnmarshalJSON

func (v *Snapshot) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Snapshot) WalkEnvironment

func (s *Snapshot) WalkEnvironment(e *Environment, wg *sync.WaitGroup)

WalkEnvironment walks the environment looking for dependencies to graph

func (*Snapshot) WalkHost

func (s *Snapshot) WalkHost(h *Host, wg *sync.WaitGroup)

WalkHost is used to identify global host dependencies

func (*Snapshot) WalkProvisionedHost

func (s *Snapshot) WalkProvisionedHost(ph *ProvisionedHost, wg *sync.WaitGroup)

WalkProvisionedHost is used to walk all the elements of a provisioned host

func (*Snapshot) WalkTeam

func (s *Snapshot) WalkTeam(t *Team, wg *sync.WaitGroup)

WalkTeam is used to enumerate the resources of a team

type State

type State struct {
	sync.RWMutex
	Base      *Laforge
	DB        *buntdb.DB
	Current   *Snapshot
	Persisted *Snapshot
	Plan      *Plan
	NewRevs   map[string]*Revision
	KnownRevs map[string]*Revision
	RevDelta  map[string]RevMod
}

State is the primary object used to interface with the build's on disk state table

func BootstrapWithState

func BootstrapWithState(overwriteBuild bool) (*State, error)

BootstrapWithState wraps much of the bootstrap process with a state tree calculation as well

func NewState

func NewState() *State

NewState returns an empty state

func (*State) CalculateDelta

func (s *State) CalculateDelta() (*Plan, error)

CalculateDelta attempts to determine what needs to be done to bring a base in line with target

func (*State) CreateDBSchema

func (s *State) CreateDBSchema() error

CreateDBSchema attempts to create the database indexes appropriately

func (*State) GenerateCurrentRevs

func (s *State) GenerateCurrentRevs() error

GenerateCurrentRevs enumerates the current snapshot and generates a listing of revisions for comparison

func (*State) GenerateRevisionDelta

func (s *State) GenerateRevisionDelta() error

GenerateRevisionDelta compares the known verses the new revisiosn and comes up with a strategy which is used in the plan calculations.

func (*State) InitializeEmptyPersistedSnapshot

func (s *State) InitializeEmptyPersistedSnapshot() error

InitializeEmptyPersistedSnapshot sets the persisted snapshot in the state to an empty one

func (*State) KnownRevHashes

func (s *State) KnownRevHashes() uint64

KnownRevHashes returns a hash of the located revision objects

func (*State) LoadSnapshotFromDB

func (s *State) LoadSnapshotFromDB() (*Snapshot, error)

LoadSnapshotFromDB attempts to load the last Snapshot object from the DB, assigning it to *State.Persisted and returning it if it was successful.

func (*State) LocateRevisions

func (s *State) LocateRevisions() error

LocateRevisions attempts to load the known revision files off disk

func (*State) NewRevHashes

func (s *State) NewRevHashes() uint64

NewRevHashes returns a hash of the new revision objects

func (*State) Open

func (s *State) Open(dbfile string) error

Open attempts to create a DB connector for the state given a local file path

func (*State) PersistSnapshot

func (s *State) PersistSnapshot(snap *Snapshot) error

PersistSnapshot will save the provided snapshot into the current snapshot entry of the database, overwriting any existing snapshot.

func (*State) SetCurrent

func (s *State) SetCurrent(snap *Snapshot)

SetCurrent sets the current snapshot

func (*State) SnapshotsEqual

func (s *State) SnapshotsEqual() bool

SnapshotsEqual are used to test the equality of the two environments and their dependencies

type StateContext

type StateContext int

StateContext is a type alias to the level of context we are currently executing in

const (
	// TeamContext is a context level representing a full team.laforge, build.laforge, env.laforge, base.laforge, and global.laforge=
	TeamContext StateContext = iota

	// BuildContext is a context level representing being within an environment's build directory
	BuildContext

	// EnvContext is a context level representing a full env.laforge + base.laforge was found
	EnvContext

	// BaseContext is a context level representing just a base.laforge was located
	BaseContext

	// GlobalContext is a context level representing a valid global configuration was found
	GlobalContext

	// NoContext is a context level representing neither a env.laforge or base.laforge was found
	NoContext
)

func (StateContext) String

func (s StateContext) String() string

type Status

type Status struct {
	State     ProvisionStatus `json:"state"`
	StartedAt time.Time       `json:"started_at,omitempty"`
	EndedAt   time.Time       `json:"ended_at,omitempty"`
	Failed    bool            `json:"failed"`
	Completed bool            `json:"completed"`
	Error     string          `json:"error,omitempty"`
}

Status represents the state of an individual object that could be provisioned within a laforge team environment

func (*Status) CanProceed

func (s *Status) CanProceed() bool

CanProceed is used to ensure the state allows further traversal

func (*Status) Current

func (s *Status) Current() ProvisionStatus

Current returns the current status

func (*Status) Hash

func (s *Status) Hash() uint64

Hash implements the Hasher interface

func (Status) MarshalEasyJSON

func (v Status) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Status) MarshalJSON

func (v Status) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Status) UnmarshalEasyJSON

func (v *Status) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Status) UnmarshalJSON

func (v *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Team

type Team struct {
	ID                  string                         `hcl:"id,label" json:"id,omitempty"`
	TeamNumber          int                            `hcl:"team_number,attr" json:"team_number,omitempty"`
	Config              map[string]string              `hcl:"config,attr" json:"config,omitempty"`
	Tags                map[string]string              `hcl:"tags,attr" json:"tags,omitempty"`
	OnConflict          *OnConflict                    `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
	Revision            int64                          `hcl:"revision,attr" json:"revision,omitempty"`
	Maintainer          *User                          `hcl:"maintainer,block" json:"maintainer,omitempty"`
	ProvisionedNetworks map[string]*ProvisionedNetwork `json:"provisioned_networks"`
	ProvisionedHosts    map[string]*ProvisionedHost    `json:"provisioned_hosts"`
	Build               *Build                         `json:"-"`
	Environment         *Environment                   `json:"-"`
	Competition         *Competition                   `json:"-"`
	RelBuildPath        string                         `json:"-"`
	TeamRoot            string                         `json:"-"`
	Dir                 string                         `json:"-"`
	Caller              Caller                         `json:"-"`
	Runner              *runner.Runner                 `json:"-"`
}

Team represents a team specific object existing within an environment

func (*Team) Associate

func (t *Team) Associate(g *Snapshot) error

Associate attempts to actually draw the relationships on the graph between dependencies

func (*Team) Base

func (t *Team) Base() string

Base implements the Pather interface

func (*Team) CreateProvisionResources

func (t *Team) CreateProvisionResources() error

CreateProvisionResources enumerates the environment's included networks and creates provisioned network objects

func (*Team) CreateProvisionedNetwork

func (t *Team) CreateProvisionedNetwork(net *Network) *ProvisionedNetwork

CreateProvisionedNetwork actually creates the provisioned network object and assigns parent pointers accordingly.

func (*Team) CreateRunner

func (t *Team) CreateRunner() *runner.Runner

CreateRunner creates a new local command runner for the team, and returns it

func (*Team) Gather

func (t *Team) Gather(g *Snapshot) error

Gather implements the Dependency interface

func (*Team) GetCaller

func (t *Team) GetCaller() Caller

GetCaller implements the Mergeable interface

func (*Team) GetOnConflict

func (t *Team) GetOnConflict() OnConflict

GetOnConflict implements the Mergeable interface

func (*Team) Hash

func (t *Team) Hash() uint64

Hash implements the Hasher interface

func (*Team) LaforgeID

func (t *Team) LaforgeID() string

LaforgeID implements the Mergeable interface

func (*Team) LoadFileDeps

func (t *Team) LoadFileDeps(base *Laforge, pr *PathResolver, caller CallFile) error

LoadFileDeps attempts ot load important key material in the team configuration for connecting to remote team hosts

func (*Team) LocateProvisionedHost

func (t *Team) LocateProvisionedHost(netid, hostid string) (*ProvisionedHost, error)

LocateProvisionedHost is used to locate the provisioned host object by specifying a global host and network ID. (useed in dependency traversal)

func (Team) MarshalEasyJSON

func (v Team) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Team) MarshalJSON

func (v Team) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Team) ParentLaforgeID

func (t *Team) ParentLaforgeID() string

ParentLaforgeID returns the Team's parent build ID

func (*Team) Path

func (t *Team) Path() string

Path implements the Pather interface

func (*Team) RunLocalCommand

func (t *Team) RunLocalCommand(command string, args []string, wg *sync.WaitGroup, errChan chan error)

RunLocalCommand runs a local command in the team's local directory

func (*Team) RunTerraformCommand

func (t *Team) RunTerraformCommand(args []string, wg *sync.WaitGroup, errChan chan error)

RunTerraformCommand runs terraform subcommands inside a team's local directory

func (*Team) RunTerraformSequence

func (t *Team) RunTerraformSequence(cmds []string, wg *sync.WaitGroup, errChan chan error)

RunTerraformSequence attempts to run a series of commands on a team

func (*Team) SetCaller

func (t *Team) SetCaller(ca Caller)

SetCaller implements the Mergeable interface

func (*Team) SetID

func (t *Team) SetID() string

SetID increments the revision and sets the team ID if needed

func (*Team) SetOnConflict

func (t *Team) SetOnConflict(o OnConflict)

SetOnConflict implements the Mergeable interface

func (*Team) Swap

func (t *Team) Swap(m Mergeable) error

Swap implements the Mergeable interface

func (*Team) TerraformInit

func (t *Team) TerraformInit() error

TerraformInit runs terraform init for a team

func (*Team) UnmarshalEasyJSON

func (v *Team) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Team) UnmarshalJSON

func (v *Team) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Team) ValidatePath

func (t *Team) ValidatePath() error

ValidatePath implements the Pather interface

type TerraformJob

type TerraformJob struct {
	GenericJob
	Commands       [][]string     `json:"commands"`
	Target         *Team          `json:"-"`
	OutputCallback OutputCallback `json:"-"`
}

TerraformJob attempts to run one or more terraform commands on the system easyjson:json

func (*TerraformJob) CanProceed

func (j *TerraformJob) CanProceed() error

CanProceed implements the Doer interface

func (*TerraformJob) CleanUp

func (j *TerraformJob) CleanUp() error

CleanUp implements the Doer interface

func (*TerraformJob) Do

func (j *TerraformJob) Do() error

Do implements the Doer interface

func (*TerraformJob) EnsureDependencies

func (j *TerraformJob) EnsureDependencies(l *Laforge) error

EnsureDependencies implements the Doer interface

func (*TerraformJob) Finish

func (j *TerraformJob) Finish() error

Finish implements the Doer interface

func (TerraformJob) MarshalEasyJSON

func (v TerraformJob) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TerraformJob) MarshalJSON

func (v TerraformJob) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TerraformJob) UnmarshalEasyJSON

func (v *TerraformJob) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TerraformJob) UnmarshalJSON

func (v *TerraformJob) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TimeoutFunc added in v0.2.1

type TimeoutFunc func(errchan chan error)

TimeoutFunc is a function that is retried ever half second until the interval period is hit

type User

type User struct {
	ID    string `hcl:"id,label" cty:"id" json:"id,omitempty"`
	Name  string `hcl:"name,attr" cty:"name" json:"name,omitempty"`
	UUID  string `hcl:"uuid,optional" cty:"uuid" json:"uuid,omitempty"`
	Email string `hcl:"email,attr" cty:"email" json:"email,omitempty"`
}

User defines a laforge command line user and their properties

func (User) MarshalEasyJSON

func (v User) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (User) MarshalJSON

func (v User) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*User) UnmarshalEasyJSON

func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*User) UnmarshalJSON

func (v *User) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WinRMAuthConfig

type WinRMAuthConfig struct {
	RemoteAddr    string        `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
	Port          int           `hcl:"port,attr" json:"port,omitempty"`
	HTTPS         bool          `hcl:"https,attr" json:"https,omitempty"`
	SkipVerify    bool          `hcl:"skip_verify,attr" json:"skip_verify,omitempty"`
	TLSServerName string        `hcl:"tls_server_name,optional" json:"tls_server_name,omitempty"`
	CAFile        string        `hcl:"ca_file,optional" json:"ca_file,omitempty"`
	CertFile      string        `hcl:"cert_file,optional" json:"cert_file,omitempty"`
	KeyFile       string        `hcl:"key_file,optional" json:"key_file,omitempty"`
	User          string        `hcl:"user,attr" json:"user,omitempty"`
	Password      string        `hcl:"password,attr" json:"password,omitempty"`
	KeyFileRef    *LocalFileRef `json:"-"`
	CertFileRef   *LocalFileRef `json:"-"`
	CAFileRef     *LocalFileRef `json:"-"`
}

WinRMAuthConfig defines how Laforge should connect via WinRM to a provisioned host

func (*WinRMAuthConfig) Hash

func (w *WinRMAuthConfig) Hash() uint64

Hash implements the Hasher interface

func (*WinRMAuthConfig) LoadCAFile

func (w *WinRMAuthConfig) LoadCAFile(base *Laforge, pr *PathResolver, caller CallFile) error

LoadCAFile attempts to locate the referenced source file with a laforge base configuration

func (*WinRMAuthConfig) LoadCertFile

func (w *WinRMAuthConfig) LoadCertFile(base *Laforge, pr *PathResolver, caller CallFile) error

LoadCertFile attempts to locate the referenced source file with a laforge base configuration

func (*WinRMAuthConfig) LoadKeyFile

func (w *WinRMAuthConfig) LoadKeyFile(base *Laforge, pr *PathResolver, caller CallFile) error

LoadKeyFile attempts to locate the referenced source file with a laforge base configuration

func (WinRMAuthConfig) MarshalEasyJSON

func (v WinRMAuthConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WinRMAuthConfig) MarshalJSON

func (v WinRMAuthConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WinRMAuthConfig) Protocol

func (w *WinRMAuthConfig) Protocol() string

Protocol implements the ShellConfig interface

func (*WinRMAuthConfig) ToUploadConfig

func (w *WinRMAuthConfig) ToUploadConfig() (string, winrmcp.Config)

ToUploadConfig returns the socket and a winrmcp config for uploading via WinRM

func (*WinRMAuthConfig) UnmarshalEasyJSON

func (v *WinRMAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WinRMAuthConfig) UnmarshalJSON

func (v *WinRMAuthConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WinRMClient

type WinRMClient struct {
	Config *WinRMAuthConfig
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

WinRMClient is a type to connection to Windows hosts remotely over the WinRM protocol

func (*WinRMClient) ExecuteNonInteractive

func (w *WinRMClient) ExecuteNonInteractive(cmd *RemoteCommand) error

ExecuteNonInteractive allows you to execute commands in a non-interactive session (note: standard command shell, not powershell)

func (*WinRMClient) Kind

func (w *WinRMClient) Kind() string

Kind implements the Sheller interface

func (*WinRMClient) LaunchInteractiveShell

func (w *WinRMClient) LaunchInteractiveShell() error

LaunchInteractiveShell implements the Sheller interface

func (*WinRMClient) SetConfig

func (w *WinRMClient) SetConfig(c *WinRMAuthConfig) error

SetConfig implements the Sheller interface

func (*WinRMClient) SetIO

func (w *WinRMClient) SetIO(stdout io.Writer, stderr io.Writer, stdin io.Reader) error

SetIO implements the Sheller interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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