Documentation
¶
Index ¶
- Constants
- Variables
- func CommHost() func(multistep.StateBag) (string, error)
- func NewArtifact(provider, dir string) packer.Artifact
- func SSHPort() func(multistep.StateBag) (int, error)
- type Builder
- type Config
- type SSHConfig
- type StepAddBox
- type StepCreateVagrantfile
- type StepPackage
- type StepSSHConfig
- type StepUp
- type VagrantDriver
- type VagrantSSHConfig
- type Vagrant_2_2_Driver
- func (d *Vagrant_2_2_Driver) Add(args []string) error
- func (d *Vagrant_2_2_Driver) Destroy(id string) error
- func (d *Vagrant_2_2_Driver) Halt(id string) error
- func (d *Vagrant_2_2_Driver) Init(args []string) error
- func (d *Vagrant_2_2_Driver) Package(args []string) error
- func (d *Vagrant_2_2_Driver) SSHConfig(id string) (*VagrantSSHConfig, error)
- func (d *Vagrant_2_2_Driver) Suspend(id string) error
- func (d *Vagrant_2_2_Driver) Up(args []string) (string, string, error)
- func (d *Vagrant_2_2_Driver) Verify() error
- func (d *Vagrant_2_2_Driver) Version() (string, error)
- type VagrantfileOptions
Constants ¶
View Source
const BuilderId = "vagrant"
This is the common builder ID to all of these artifacts.
View Source
const VAGRANT_MIN_VERSION = ">= 2.0.2"
Variables ¶
View Source
var DEFAULT_TEMPLATE = `` /* 435-byte string literal not displayed */
Functions ¶
func NewArtifact ¶
NewArtifact returns a vagrant artifact containing the .box file
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder implements packer.Builder and builds the actual VirtualBox images.
type Config ¶
type Config struct {
common.PackerConfig `mapstructure:",squash"`
common.HTTPConfig `mapstructure:",squash"`
common.ISOConfig `mapstructure:",squash"`
common.FloppyConfig `mapstructure:",squash"`
bootcommand.BootConfig `mapstructure:",squash"`
SSHConfig `mapstructure:",squash"`
// The directory to create that will contain your output box. We always
// create this directory and run from inside of it to prevent Vagrant init
// collisions. If unset, it will be set to packer- plus your buildname.
OutputDir string `mapstructure:"output_dir" required:"false"`
// URL of the vagrant box to use, or the name of the vagrant box.
// hashicorp/precise64, ./mylocalbox.box and https://example.com/my-box.box
// are all valid source boxes. If your source is a .box file, whether
// locally or from a URL like the latter example above, you will also need
// to provide a box_name. This option is required, unless you set
// global_id. You may only set one or the other, not both.
SourceBox string `mapstructure:"source_path" required:"true"`
// the global id of a Vagrant box already added to Vagrant on your system.
// You can find the global id of your Vagrant boxes using the command
// vagrant global-status; your global_id will be a 7-digit number and
// letter comination that you'll find in the leftmost column of the
// global-status output. If you choose to use global_id instead of
// source_box, Packer will skip the Vagrant initialize and add steps, and
// simply launch the box directly using the global id.
GlobalID string `mapstructure:"global_id" required:"true"`
// The checksum for the .box file. The type of the checksum is specified
// with checksum_type, documented below.
Checksum string `mapstructure:"checksum" required:"false"`
// The type of the checksum specified in checksum. Valid values are none,
// md5, sha1, sha256, or sha512. Although the checksum will not be verified
// when checksum_type is set to "none", this is not recommended since OVA
// files can be very large and corruption does happen from time to time.
ChecksumType string `mapstructure:"checksum_type" required:"false"`
// if your source_box is a boxfile that we need to add to Vagrant, this is
// the name to give it. If left blank, will default to "packer_" plus your
// buildname.
BoxName string `mapstructure:"box_name" required:"false"`
// The vagrant provider.
// This parameter is required when source_path have more than one provider,
// or when using vagrant-cloud post-processor. Defaults to unset.
Provider string `mapstructure:"provider" required:"false"`
Communicator string `mapstructure:"communicator"`
// What vagrantfile to use
VagrantfileTpl string `mapstructure:"vagrantfile_template"`
// Whether to halt, suspend, or destroy the box when the build has
// completed. Defaults to "halt"
TeardownMethod string `mapstructure:"teardown_method" required:"false"`
// What box version to use when initializing Vagrant.
BoxVersion string `mapstructure:"box_version" required:"false"`
// a path to a golang template for a vagrantfile. Our default template can
// be found here. So far the only template variables available to you are
// {{ .BoxName }} and {{ .SyncedFolder }}, which correspond to the Packer
// options box_name and synced_folder.
Template string `mapstructure:"template" required:"false"`
SyncedFolder string `mapstructure:"synced_folder"`
// Don't call "vagrant add" to add the box to your local environment; this
// is necessary if you want to launch a box that is already added to your
// vagrant environment.
SkipAdd bool `mapstructure:"skip_add" required:"false"`
// Equivalent to setting the
// --cacert
// option in vagrant add; defaults to unset.
AddCACert string `mapstructure:"add_cacert" required:"false"`
// Equivalent to setting the
// --capath option
// in vagrant add; defaults to unset.
AddCAPath string `mapstructure:"add_capath" required:"false"`
// Equivalent to setting the
// --cert option in
// vagrant add; defaults to unset.
AddCert string `mapstructure:"add_cert" required:"false"`
// Equivalent to setting the
// --clean flag in
// vagrant add; defaults to unset.
AddClean bool `mapstructure:"add_clean" required:"false"`
// Equivalent to setting the
// --force flag in
// vagrant add; defaults to unset.
AddForce bool `mapstructure:"add_force" required:"false"`
// Equivalent to setting the
// --insecure flag in
// vagrant add; defaults to unset.
AddInsecure bool `mapstructure:"add_insecure" required:"false"`
// if true, Packer will not call vagrant package to
// package your base box into its own standalone .box file.
SkipPackage bool `mapstructure:"skip_package" required:"false"`
OutputVagrantfile string `mapstructure:"output_vagrantfile"`
PackageInclude []string `mapstructure:"package_include"`
// contains filtered or unexported fields
}
type SSHConfig ¶
type SSHConfig struct {
Comm communicator.Config `mapstructure:",squash"`
}
type StepAddBox ¶
type StepAddBox struct {
BoxVersion string
CACert string
CAPath string
DownloadCert string
Clean bool
Force bool
Insecure bool
Provider string
SourceBox string
BoxName string
GlobalID string
SkipAdd bool
}
func (*StepAddBox) Cleanup ¶
func (s *StepAddBox) Cleanup(state multistep.StateBag)
func (*StepAddBox) Run ¶
func (s *StepAddBox) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepCreateVagrantfile ¶
type StepCreateVagrantfile struct {
Template string
OutputDir string
SyncedFolder string
GlobalID string
SourceBox string
BoxName string
}
func (*StepCreateVagrantfile) Cleanup ¶
func (s *StepCreateVagrantfile) Cleanup(state multistep.StateBag)
func (*StepCreateVagrantfile) Run ¶
func (s *StepCreateVagrantfile) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepPackage ¶
func (*StepPackage) Cleanup ¶
func (s *StepPackage) Cleanup(state multistep.StateBag)
func (*StepPackage) Run ¶
func (s *StepPackage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepSSHConfig ¶
type StepSSHConfig struct {
GlobalID string
}
func (*StepSSHConfig) Cleanup ¶
func (s *StepSSHConfig) Cleanup(state multistep.StateBag)
func (*StepSSHConfig) Run ¶
func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type VagrantDriver ¶
type VagrantDriver interface {
// Calls "vagrant init"
Init([]string) error
// Calls "vagrant add"
Add([]string) error
// Calls "vagrant up"
Up([]string) (string, string, error)
// Calls "vagrant halt"
Halt(string) error
// Calls "vagrant suspend"
Suspend(string) error
SSHConfig(string) (*VagrantSSHConfig, error)
// Calls "vagrant destroy"
Destroy(string) error
// Calls "vagrant package"[
Package([]string) error
// Verify checks to make sure that this driver should function
// properly. If there is any indication the driver can't function,
// this will return an error.
Verify() error
// Version reads the version of VirtualBox that is installed.
Version() (string, error)
}
func NewDriver ¶
func NewDriver(outputDir string) (VagrantDriver, error)
type VagrantSSHConfig ¶
type Vagrant_2_2_Driver ¶
type Vagrant_2_2_Driver struct {
VagrantCWD string
// contains filtered or unexported fields
}
func (*Vagrant_2_2_Driver) Add ¶
func (d *Vagrant_2_2_Driver) Add(args []string) error
Calls "vagrant add"
func (*Vagrant_2_2_Driver) Destroy ¶
func (d *Vagrant_2_2_Driver) Destroy(id string) error
Calls "vagrant destroy"
func (*Vagrant_2_2_Driver) Halt ¶
func (d *Vagrant_2_2_Driver) Halt(id string) error
Calls "vagrant halt"
func (*Vagrant_2_2_Driver) Init ¶
func (d *Vagrant_2_2_Driver) Init(args []string) error
Calls "vagrant init"
func (*Vagrant_2_2_Driver) Package ¶
func (d *Vagrant_2_2_Driver) Package(args []string) error
Calls "vagrant package"
func (*Vagrant_2_2_Driver) SSHConfig ¶
func (d *Vagrant_2_2_Driver) SSHConfig(id string) (*VagrantSSHConfig, error)
func (*Vagrant_2_2_Driver) Suspend ¶
func (d *Vagrant_2_2_Driver) Suspend(id string) error
Calls "vagrant suspend"
func (*Vagrant_2_2_Driver) Up ¶
func (d *Vagrant_2_2_Driver) Up(args []string) (string, string, error)
Calls "vagrant up"
func (*Vagrant_2_2_Driver) Verify ¶
func (d *Vagrant_2_2_Driver) Verify() error
Verify makes sure that Vagrant exists at the given path
func (*Vagrant_2_2_Driver) Version ¶
func (d *Vagrant_2_2_Driver) Version() (string, error)
Version reads the version of VirtualBox that is installed.
type VagrantfileOptions ¶
Click to show internal directories.
Click to hide internal directories.