packer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx *app.Context, opts *BuildOptions) error

Build can be used to build an artifact with Packer and parse the artifact out into a Build properly.

This function automatically knows how to parse various built-in artifacts of Packer. For the exact functionality of the parse functions, see the documentation of the various parse functions.

This function implements the app.App.Build function. TODO: Test

func Project

func Project(ctx *context.Shared) *hashitools.Project

Project returns the hashitools Project for this.

Types

type BuildOptions

type BuildOptions struct {
	// Dir is the directory where Packer will be executed from.
	// If this isn't set, it'll default to "#{ctx.Dir}/build"
	Dir string

	// The path to the template to execute. If this isn't set, it'll
	// default to "#{Dir}/template.json"
	TemplatePath string

	// InfraOutputMap is a map to change the key of an infra output
	// to a different key for a Packer variable. The key of this map
	// is the infra output key, and teh value is the Packer variable name.
	InfraOutputMap map[string]string
}

type Output

type Output struct {
	Timestamp string
	Target    string
	Type      string
	Data      []string
}

Output is a single line of machine-readable output from Packer.

func (*Output) GoString

func (o *Output) GoString() string

For testing

type OutputCallback

type OutputCallback func(*Output)

OutputCallback is the type that is called when there is a matching machine-readable output line for the UI.

func ParseArtifactAmazon

func ParseArtifactAmazon(m map[string]string) OutputCallback

ParseArtifactAmazon parses AMIs out of the output.

The map will be populated where the key is the region and the value is the AMI ID.

type Packer

type Packer struct {
	// Path is the path to Packer itself. If empty, "packer"
	// will be used and looked up via the PATH var.
	Path string

	// Dir is the working directory where all Packer commands are executed
	Dir string

	// Ui, if given, will be used to stream output from the Packer commands.
	// If this is nil, then the output will be logged but won't be visible
	// to the user.
	Ui ui.Ui

	// Callbacks is a list of callbacks that will be called for certain
	// event types within the output
	Callbacks map[string]OutputCallback

	// Variables is a list of variables to pass to Packer.
	Variables map[string]string
}

Packer wraps `packer` execution into an easy-to-use API

func (*Packer) Execute

func (p *Packer) Execute(commandRaw ...string) error

Execute executes a raw Packer command.

Jump to

Keyboard shortcuts

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