Documentation ¶
Index ¶
- Constants
- func LXDCommand(args ...string) (string, error)
- func ShellCommand(command string) *exec.Cmd
- type Artifact
- type Builder
- type CommandWrapper
- type Communicator
- func (c *Communicator) Download(src string, w io.Writer) error
- func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error
- func (c *Communicator) Execute(commandString string) (*exec.Cmd, error)
- func (c *Communicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error
- func (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error
- func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
- type Config
- type FlatConfig
- type StepProvision
Constants ¶
const BuilderId = "lxd"
The unique ID for this builder
Variables ¶
This section is empty.
Functions ¶
func LXDCommand ¶
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 ¶
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 }
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) ConfigSpec ¶ added in v1.5.0
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type CommandWrapper ¶
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) DownloadDir ¶
func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error
func (*Communicator) Execute ¶
func (c *Communicator) Execute(commandString string) (*exec.Cmd, 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
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.
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"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` 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.
type StepProvision ¶
type StepProvision struct{}
StepProvision provisions the container
func (*StepProvision) Cleanup ¶
func (s *StepProvision) Cleanup(state multistep.StateBag)
func (*StepProvision) Run ¶
func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction