lxd

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "lxd"

The unique ID for this builder

Variables

This section is empty.

Functions

func LXDCommand

func LXDCommand(args ...string) (string, error)

Yeah...LXD calls `lxc` because the command line is different between the packages. This should also avoid a naming collision between the LXC builder.

func ShellCommand

func ShellCommand(command string) *exec.Cmd

ShellCommand takes a command string and returns an *exec.Cmd to execute it within the context of a shell (/bin/sh).

Types

type Artifact

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

func (*Artifact) BuilderId

func (*Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

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

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

type CommandWrapper

type CommandWrapper func(string) (string, error)

CommandWrapper is a type that given a command, will possibly modify that command in-flight. This might return an error.

type Communicator

type Communicator struct {
	ContainerName string
	CmdWrapper    CommandWrapper
}

func (*Communicator) Download

func (c *Communicator) Download(src string, w io.Writer) error

func (*Communicator) DownloadDir

func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error

func (*Communicator) Execute

func (c *Communicator) Execute(commandString string) (*exec.Cmd, error)

func (*Communicator) Start

func (c *Communicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error

func (*Communicator) Upload

func (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error

func (*Communicator) UploadDir

func (c *Communicator) UploadDir(dst string, src string, exclude []string) error

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	// The name of the output artifact. Defaults to
	// name.
	OutputImage   string `mapstructure:"output_image" required:"false"`
	ContainerName string `mapstructure:"container_name"`
	// Lets you prefix all builder commands, such as
	// with ssh for a remote build host. Defaults to "".
	CommandWrapper string `mapstructure:"command_wrapper" required:"false"`
	// The source image to use when creating the build
	// container. This can be a (local or remote) image (name or fingerprint).
	// E.G. my-base-image, ubuntu-daily:x, 08fababf6f27, ...
	Image   string `mapstructure:"image" required:"true"`
	Profile string `mapstructure:"profile"`
	// The number of seconds to sleep between launching
	// the LXD instance and provisioning it; defaults to 3 seconds.
	InitSleep string `mapstructure:"init_sleep" required:"false"`
	// Pass key values to the publish
	// step to be set as properties on the output image. This is most helpful to
	// set the description, but can be used to set anything needed. See
	// https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/
	// for more properties.
	PublishProperties map[string]string `mapstructure:"publish_properties" required:"false"`
	// List of key/value pairs you wish to
	// pass to lxc launch via --config. Defaults to empty.
	LaunchConfig map[string]string `mapstructure:"launch_config" required:"false"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(raws ...interface{}) (*Config, error)

type StepProvision

type StepProvision struct{}

StepProvision provisions the container

func (*StepProvision) Cleanup

func (s *StepProvision) Cleanup(state multistep.StateBag)

func (*StepProvision) Run

Jump to

Keyboard shortcuts

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