Documentation
¶
Overview ¶
vagrant implements the packersdk.PostProcessor interface and adds a post-processor that turns artifacts of known builders into Vagrant boxes.
Index ¶
- Constants
- Variables
- func CopyContents(dst, src string) error
- func CopyDirectoryContents(dst, src string) error
- func CreateDummyBox(ui packersdk.Ui, level int) error
- func DirToBox(dst, dir string, ui packersdk.Ui, level int) error
- func LinkFile(dst, src string) error
- func WriteMetadata(dir string, contents interface{}) error
- type Artifact
- type Config
- type FlatConfig
- type PostProcessor
- func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec
- func (p *PostProcessor) Configure(raws ...interface{}) error
- func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error)
- func (p *PostProcessor) PostProcessProvider(name string, provider Provider, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, error)
- type Provider
- type UtmProvider
Constants ¶
const BuilderId = "naveenrajm7.utm.post-processor.vagrant"
Variables ¶
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") )
Functions ¶
func CopyContents ¶
Copies a file by copying the contents of the file to another place.
func CopyDirectoryContents ¶
Copies the contents of a directory to another place.
func CreateDummyBox ¶
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 DirToBox ¶
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 WriteMetadata ¶
WriteMetadata writes the "metadata.json" file for a Vagrant box.
Types ¶
type Artifact ¶
func NewArtifact ¶
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"`
Architecture string `mapstructure:"architecture"`
// contains filtered or unexported fields
}
type FlatConfig ¶
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"`
Architecture *string `mapstructure:"architecture" cty:"architecture" hcl:"architecture"`
}
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type PostProcessor ¶
type PostProcessor struct {
// contains filtered or unexported fields
}
PostProcessor implements packersdk.PostProcessor Creates a Vagrant box of a given UTM directory (UTM VM bundle)
func (*PostProcessor) ConfigSpec ¶
func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec
func (*PostProcessor) Configure ¶
func (p *PostProcessor) Configure(raws ...interface{}) error
func (*PostProcessor) PostProcess ¶
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(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 UtmProvider ¶
type UtmProvider struct{}
func (*UtmProvider) KeepInputArtifact ¶
func (p *UtmProvider) KeepInputArtifact() bool