lxd

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MPL-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Code generated by "mapstructure-to-hcl2 -type Config"; DO NOT EDIT.

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 {

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
	// 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) ConfigSpec added in v1.5.0

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, []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 `{{.Command}}`; i.e. no
	// wrapper.
	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 (*Config) FlatMapstructure added in v1.4.5

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

func (*Config) Prepare added in v1.5.0

func (c *Config) Prepare(raws ...interface{}) error

type FlatConfig added in v1.4.5

type FlatConfig struct {
	PackerBuildName     *string           `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
	PackerBuilderType   *string           `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
	PackerDebug         *bool             `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
	PackerForce         *bool             `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
	PackerOnError       *string           `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
	PackerUserVars      map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
	PackerSensitiveVars []string          `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
	OutputImage         *string           `mapstructure:"output_image" required:"false" cty:"output_image" hcl:"output_image"`
	ContainerName       *string           `mapstructure:"container_name" cty:"container_name" hcl:"container_name"`
	CommandWrapper      *string           `mapstructure:"command_wrapper" required:"false" cty:"command_wrapper" hcl:"command_wrapper"`
	Image               *string           `mapstructure:"image" required:"true" cty:"image" hcl:"image"`
	Profile             *string           `mapstructure:"profile" cty:"profile" hcl:"profile"`
	InitSleep           *string           `mapstructure:"init_sleep" required:"false" cty:"init_sleep" hcl:"init_sleep"`
	PublishProperties   map[string]string `mapstructure:"publish_properties" required:"false" cty:"publish_properties" hcl:"publish_properties"`
	LaunchConfig        map[string]string `mapstructure:"launch_config" required:"false" cty:"launch_config" hcl:"launch_config"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec added in v1.4.5

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

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