vagrant

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Overview

vagrant implements the packersdk.PostProcessor interface and adds a post-processor that turns artifacts of known builders into Vagrant boxes.

Index

Constants

View Source
const BuilderId = "mitchellh.post-processor.vagrant"

Variables

View Source
var (
	// ErrInvalidCompressionLevel is returned when the compression level passed
	// to gzip is not in the expected range. See compress/flate for details.
	ErrInvalidCompressionLevel = fmt.Errorf(
		"Invalid compression level. Expected an integer from -1 to 9.")
)
View Source
var UnnecessaryFilesPatterns = []string{"\\.log$", "\\.backup$", "\\.Backup$", "\\.app/", "/Windows Disks/"}

These are the extensions of files and directories that are unnecessary for the function of a Parallels virtual machine.

Functions

func CopyContents added in v0.1.5

func CopyContents(dst, src string) error

Copies a file by copying the contents of the file to another place.

func CreateDummyBox added in v1.5.2

func CreateDummyBox(ui packersdk.Ui, level int) error

CreateDummyBox create a dummy Vagrant-compatible box under temporary dir This function is mainly used to check cases such as the host system having a GNU tar incompatible uname that will cause the actual Vagrant box creation to fail later

func DecompressOva added in v0.3.5

func DecompressOva(dir, src string) error

DecompressOva takes an ova file and decompresses it into the target directory.

func DirToBox

func DirToBox(dst, dir string, ui packersdk.Ui, level int) error

DirToBox takes the directory and compresses it into a Vagrant-compatible box. This function does not perform checks to verify that dir is actually a proper box. This is an expected precondition.

func LinkFile added in v1.1.1

func LinkFile(dst, src string) error

Creates a (hard) link to a file, ensuring that all parent directories also exist.

func WriteMetadata

func WriteMetadata(dir string, contents interface{}) error

WriteMetadata writes the "metadata.json" file for a Vagrant box.

Types

type AWSProvider added in v0.5.0

type AWSProvider struct{}

func (*AWSProvider) KeepInputArtifact added in v0.5.2

func (p *AWSProvider) KeepInputArtifact() bool

func (*AWSProvider) Process added in v0.5.0

func (p *AWSProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type Artifact

type Artifact struct {
	Path     string
	Provider string
}

func NewArtifact

func NewArtifact(provider, path string) *Artifact

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 added in v0.7.2

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

func (*Artifact) String

func (a *Artifact) String() string

type AzureProvider added in v1.3.0

type AzureProvider struct{}

func (*AzureProvider) KeepInputArtifact added in v1.3.0

func (p *AzureProvider) KeepInputArtifact() bool

func (*AzureProvider) Process added in v1.3.0

func (p *AzureProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`

	CompressionLevel             int      `mapstructure:"compression_level"`
	Include                      []string `mapstructure:"include"`
	OutputPath                   string   `mapstructure:"output"`
	Override                     map[string]interface{}
	VagrantfileTemplate          string `mapstructure:"vagrantfile_template"`
	VagrantfileTemplateGenerated bool   `mapstructure:"vagrantfile_template_generated"`
	ProviderOverride             string `mapstructure:"provider_override"`
	// 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 DigitalOceanProvider added in v0.5.0

type DigitalOceanProvider struct{}

func (*DigitalOceanProvider) KeepInputArtifact added in v0.5.2

func (p *DigitalOceanProvider) KeepInputArtifact() bool

func (*DigitalOceanProvider) Process added in v0.5.0

func (p *DigitalOceanProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type DockerProvider added in v1.3.0

type DockerProvider struct{}

func (*DockerProvider) KeepInputArtifact added in v1.3.0

func (p *DockerProvider) KeepInputArtifact() bool

func (*DockerProvider) Process added in v1.3.0

func (p *DockerProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err 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"`
	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"`
	CompressionLevel             *int                   `mapstructure:"compression_level" cty:"compression_level" hcl:"compression_level"`
	Include                      []string               `mapstructure:"include" cty:"include" hcl:"include"`
	OutputPath                   *string                `mapstructure:"output" cty:"output" hcl:"output"`
	Override                     map[string]interface{} `cty:"override" hcl:"override"`
	VagrantfileTemplate          *string                `mapstructure:"vagrantfile_template" cty:"vagrantfile_template" hcl:"vagrantfile_template"`
	VagrantfileTemplateGenerated *bool                  `mapstructure:"vagrantfile_template_generated" cty:"vagrantfile_template_generated" hcl:"vagrantfile_template_generated"`
	ProviderOverride             *string                `mapstructure:"provider_override" cty:"provider_override" hcl:"provider_override"`
}

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 GoogleProvider added in v1.2.0

type GoogleProvider struct{}

func (*GoogleProvider) KeepInputArtifact added in v1.2.0

func (p *GoogleProvider) KeepInputArtifact() bool

func (*GoogleProvider) Process added in v1.2.0

func (p *GoogleProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type HypervProvider added in v0.6.1

type HypervProvider struct{}

func (*HypervProvider) KeepInputArtifact added in v0.6.1

func (p *HypervProvider) KeepInputArtifact() bool

func (*HypervProvider) Process added in v0.6.1

func (p *HypervProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type LXCProvider added in v1.2.2

type LXCProvider struct{}

func (*LXCProvider) KeepInputArtifact added in v1.2.2

func (p *LXCProvider) KeepInputArtifact() bool

func (*LXCProvider) Process added in v1.2.2

func (p *LXCProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type LibVirtProvider added in v0.7.2

type LibVirtProvider struct{}

func (*LibVirtProvider) KeepInputArtifact added in v0.7.2

func (p *LibVirtProvider) KeepInputArtifact() bool

func (*LibVirtProvider) Process added in v0.7.2

func (p *LibVirtProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type ParallelsProvider added in v0.6.0

type ParallelsProvider struct{}

func (*ParallelsProvider) KeepInputArtifact added in v0.6.0

func (p *ParallelsProvider) KeepInputArtifact() bool

func (*ParallelsProvider) Process added in v0.6.0

func (p *ParallelsProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type PostProcessor

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

func (*PostProcessor) ConfigSpec added in v1.5.0

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

func (*PostProcessor) Configure

func (p *PostProcessor) Configure(raws ...interface{}) error

func (*PostProcessor) PostProcess

func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error)

func (*PostProcessor) PostProcessProvider added in v0.7.2

func (p *PostProcessor) PostProcessProvider(name string, provider Provider, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, error)

type Provider added in v0.5.0

type Provider interface {
	// KeepInputArtifact should return true/false whether this provider
	// requires the input artifact to be kept by default.
	KeepInputArtifact() bool

	// Process is called to process an artifact into a Vagrant box. The
	// artifact is given as well as the temporary directory path to
	// put things.
	//
	// The Provider should return the contents for the Vagrantfile,
	// any metadata (including the provider type in that), and an error
	// if any.
	Process(packersdk.Ui, packersdk.Artifact, string) (vagrantfile string, metadata map[string]interface{}, err error)
}

Provider is the interface that each provider must implement in order to package the artifacts into a Vagrant-compatible box.

type ScalewayProvider added in v1.2.0

type ScalewayProvider struct{}

func (*ScalewayProvider) KeepInputArtifact added in v1.2.0

func (p *ScalewayProvider) KeepInputArtifact() bool

func (*ScalewayProvider) Process added in v1.2.0

func (p *ScalewayProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type VBoxProvider added in v0.5.0

type VBoxProvider struct{}

func (*VBoxProvider) KeepInputArtifact added in v0.5.2

func (p *VBoxProvider) KeepInputArtifact() bool

func (*VBoxProvider) Process added in v0.5.0

func (p *VBoxProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

type VMwareProvider added in v0.5.0

type VMwareProvider struct{}

func (*VMwareProvider) KeepInputArtifact added in v0.5.2

func (p *VMwareProvider) KeepInputArtifact() bool

func (*VMwareProvider) Process added in v0.5.0

func (p *VMwareProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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