vagrant

package
v0.0.0-...-9eb14d7 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

vagrant implements the packer.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

func CopyContents(dst, src string) error

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

func DecompressOva

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 packer.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

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

type AWSProvider struct{}

func (*AWSProvider) KeepInputArtifact

func (p *AWSProvider) KeepInputArtifact() bool

func (*AWSProvider) Process

func (p *AWSProvider) Process(ui packer.Ui, artifact packer.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

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

func (*Artifact) String

func (a *Artifact) String() string

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"`
	// contains filtered or unexported fields
}

type DigitalOceanProvider

type DigitalOceanProvider struct{}

func (*DigitalOceanProvider) KeepInputArtifact

func (p *DigitalOceanProvider) KeepInputArtifact() bool

func (*DigitalOceanProvider) Process

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

type HypervProvider

type HypervProvider struct{}

func (*HypervProvider) KeepInputArtifact

func (p *HypervProvider) KeepInputArtifact() bool

func (*HypervProvider) Process

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

type LibVirtProvider

type LibVirtProvider struct{}

func (*LibVirtProvider) KeepInputArtifact

func (p *LibVirtProvider) KeepInputArtifact() bool

func (*LibVirtProvider) Process

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

type ParallelsProvider

type ParallelsProvider struct{}

func (*ParallelsProvider) KeepInputArtifact

func (p *ParallelsProvider) KeepInputArtifact() bool

func (*ParallelsProvider) Process

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

type PostProcessor

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

func (*PostProcessor) Configure

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

func (*PostProcessor) PostProcess

func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, error)

func (*PostProcessor) PostProcessProvider

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

type Provider

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(packer.Ui, packer.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 VBoxProvider

type VBoxProvider struct{}

func (*VBoxProvider) KeepInputArtifact

func (p *VBoxProvider) KeepInputArtifact() bool

func (*VBoxProvider) Process

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

type VMwareProvider

type VMwareProvider struct{}

func (*VMwareProvider) KeepInputArtifact

func (p *VMwareProvider) KeepInputArtifact() bool

func (*VMwareProvider) Process

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

Jump to

Keyboard shortcuts

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