file

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MPL-2.0 Imports: 14 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.8.0

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	// This is the content to copy to `destination`. If destination is a file,
	// content will be written to that file, in case of a directory a file named
	// `pkr-file-content` is created. It's recommended to use a file as the
	// destination. The `templatefile` function might be used here, or any
	// interpolation syntax. This attribute cannot be specified with source or
	// sources.
	Content string `mapstructure:"content" required:"true"`
	// The path to a local file or directory to upload to the
	// machine. The path can be absolute or relative. If it is relative, it is
	// relative to the working directory when Packer is executed. If this is a
	// directory, the existence of a trailing slash is important. Read below on
	// uploading directories. Mandatory unless `sources` is set.
	Source string `mapstructure:"source" required:"true"`
	// A list of sources to upload. This can be used in place of the `source`
	// option if you have several files that you want to upload to the same
	// place. Note that the destination must be a directory with a trailing
	// slash, and that all files listed in `sources` will be uploaded to the
	// same directory with their file names preserved.
	Sources []string `mapstructure:"sources" required:"false"`
	// The path where the file will be uploaded to in the machine. This value
	// must be a writable location and any parent directories
	// must already exist. If the provisioning user (generally not root) cannot
	// write to this directory, you will receive a "Permission Denied" error.
	// If the source is a file, it's a good idea to make the destination a file
	// as well, but if you set your destination as a directory, at least make
	// sure that the destination ends in a trailing slash so that Packer knows
	// to use the source's basename in the final upload path. Failure to do so
	// may cause Packer to fail on file uploads. If the destination file
	// already exists, it will be overwritten.
	Destination string `mapstructure:"destination" required:"true"`
	// The direction of the file transfer. This defaults to "upload". If it is
	// set to "download" then the file "source" in the machine will be
	// downloaded locally to "destination"
	Direction string `mapstructure:"direction" required:"false"`
	// For advanced users only. If true, check the file existence only before
	// uploading, rather than upon pre-build validation. This allows users to
	// upload files created on-the-fly. This defaults to false. We
	// don't recommend using this feature, since it can cause Packer to become
	// dependent on system state. We would prefer you generate your files before
	// the Packer run, but realize that there are situations where this may be
	// unavoidable.
	Generated bool `mapstructure:"generated" 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.

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"`
	Content             *string           `mapstructure:"content" required:"true" cty:"content" hcl:"content"`
	Source              *string           `mapstructure:"source" required:"true" cty:"source" hcl:"source"`
	Sources             []string          `mapstructure:"sources" required:"false" cty:"sources" hcl:"sources"`
	Destination         *string           `mapstructure:"destination" required:"true" cty:"destination" hcl:"destination"`
	Direction           *string           `mapstructure:"direction" required:"false" cty:"direction" hcl:"direction"`
	Generated           *bool             `mapstructure:"generated" required:"false" cty:"generated" hcl:"generated"`
}

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 Provisioner

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

func (*Provisioner) ConfigSpec added in v1.5.0

func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec

func (*Provisioner) Prepare

func (p *Provisioner) Prepare(raws ...interface{}) error

func (*Provisioner) Provision

func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, generatedData map[string]interface{}) error

func (*Provisioner) ProvisionDownload added in v0.8.0

func (p *Provisioner) ProvisionDownload(ui packersdk.Ui, comm packersdk.Communicator) error

func (*Provisioner) ProvisionUpload added in v0.8.0

func (p *Provisioner) ProvisionUpload(ui packersdk.Ui, comm packersdk.Communicator) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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