Documentation ¶
Index ¶
- Constants
- func CommHost(host string) func(multistep.StateBag) (string, error)
- func NewArtifact(dir string) (packer.Artifact, error)
- func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)
- func SSHPort(state multistep.StateBag) (int, error)
- type Driver
- type DriverMock
- func (d *DriverMock) CreateSATAController(vm string, controller string) error
- func (d *DriverMock) CreateSCSIController(vm string, controller string) error
- func (d *DriverMock) Delete(name string) error
- func (d *DriverMock) Import(name string, path string, flags []string) error
- func (d *DriverMock) IsRunning(name string) (bool, error)
- func (d *DriverMock) Iso() (string, error)
- func (d *DriverMock) Stop(name string) error
- func (d *DriverMock) SuppressMessages() error
- func (d *DriverMock) VBoxManage(args ...string) error
- func (d *DriverMock) Verify() error
- func (d *DriverMock) Version() (string, error)
- type ExportConfig
- type ExportOpts
- type OutputConfig
- type RunConfig
- type SSHConfig
- type ShutdownConfig
- type StepAttachFloppy
- type StepAttachGuestAdditions
- type StepConfigureVRDP
- type StepDownloadGuestAdditions
- type StepExport
- type StepForwardSSH
- type StepOutputDir
- type StepRemoveDevices
- type StepRun
- type StepShutdown
- type StepSuppressMessages
- type StepTypeBootCommand
- type StepUploadGuestAdditions
- type StepUploadVersion
- type StepVBoxManage
- type VBox42Driver
- func (d *VBox42Driver) CreateSATAController(vmName string, name string) error
- func (d *VBox42Driver) CreateSCSIController(vmName string, name string) error
- func (d *VBox42Driver) Delete(name string) error
- func (d *VBox42Driver) Import(name string, path string, flags []string) error
- func (d *VBox42Driver) IsRunning(name string) (bool, error)
- func (d *VBox42Driver) Iso() (string, error)
- func (d *VBox42Driver) Stop(name string) error
- func (d *VBox42Driver) SuppressMessages() error
- func (d *VBox42Driver) VBoxManage(args ...string) error
- func (d *VBox42Driver) Verify() error
- func (d *VBox42Driver) Version() (string, error)
- type VBoxManageConfig
- type VBoxManagePostConfig
- type VBoxVersionConfig
Constants ¶
const ( GuestAdditionsModeDisable string = "disable" GuestAdditionsModeAttach = "attach" GuestAdditionsModeUpload = "upload" )
These are the different valid mode values for "guest_additions_mode" which determine how guest additions are delivered to the guest.
const BuilderId = "mitchellh.virtualbox"
This is the common builder ID to all of these artifacts.
const KeyLeftShift uint32 = 0xFFE1
Variables ¶
This section is empty.
Functions ¶
func NewArtifact ¶
NewArtifact returns a VirtualBox artifact containing the files in the given directory.
func SSHConfigFunc ¶
Types ¶
type Driver ¶
type Driver interface { // Create a SATA controller. CreateSATAController(vm string, controller string) error // Create a SCSI controller. CreateSCSIController(vm string, controller string) error // Delete a VM by name Delete(string) error // Import a VM Import(string, string, []string) error // The complete path to the Guest Additions ISO Iso() (string, error) // Checks if the VM with the given name is running. IsRunning(string) (bool, error) // Stop stops a running machine, forcefully. Stop(string) error // SuppressMessages should do what needs to be done in order to // suppress any annoying popups from VirtualBox. SuppressMessages() error // VBoxManage executes the given VBoxManage command VBoxManage(...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) }
A driver is able to talk to VirtualBox and perform certain operations with it. Some of the operations on here may seem overly specific, but they were built specifically in mind to handle features of the VirtualBox builder for Packer, and to abstract differences in versions out of the builder steps, so sometimes the methods are extremely specific.
type DriverMock ¶
type DriverMock struct { sync.Mutex CreateSATAControllerVM string CreateSATAControllerController string CreateSATAControllerErr error CreateSCSIControllerVM string CreateSCSIControllerController string CreateSCSIControllerErr error DeleteCalled bool DeleteName string DeleteErr error ImportCalled bool ImportName string ImportPath string ImportFlags []string ImportErr error IsoCalled bool IsoErr error IsRunningName string IsRunningReturn bool IsRunningErr error StopName string StopErr error SuppressMessagesCalled bool SuppressMessagesErr error VBoxManageCalls [][]string VBoxManageErrs []error VerifyCalled bool VerifyErr error VersionCalled bool VersionResult string VersionErr error }
func (*DriverMock) CreateSATAController ¶
func (d *DriverMock) CreateSATAController(vm string, controller string) error
func (*DriverMock) CreateSCSIController ¶ added in v0.8.0
func (d *DriverMock) CreateSCSIController(vm string, controller string) error
func (*DriverMock) Delete ¶
func (d *DriverMock) Delete(name string) error
func (*DriverMock) Import ¶
func (d *DriverMock) Import(name string, path string, flags []string) error
func (*DriverMock) Iso ¶ added in v0.6.1
func (d *DriverMock) Iso() (string, error)
func (*DriverMock) Stop ¶
func (d *DriverMock) Stop(name string) error
func (*DriverMock) SuppressMessages ¶
func (d *DriverMock) SuppressMessages() error
func (*DriverMock) VBoxManage ¶
func (d *DriverMock) VBoxManage(args ...string) error
func (*DriverMock) Verify ¶
func (d *DriverMock) Verify() error
func (*DriverMock) Version ¶
func (d *DriverMock) Version() (string, error)
type ExportConfig ¶
type ExportConfig struct {
Format string `mapstruture:"format"`
}
func (*ExportConfig) Prepare ¶
func (c *ExportConfig) Prepare(ctx *interpolate.Context) []error
type ExportOpts ¶ added in v0.6.0
type ExportOpts struct {
ExportOpts []string `mapstructure:"export_opts"`
}
func (*ExportOpts) Prepare ¶ added in v0.6.0
func (c *ExportOpts) Prepare(ctx *interpolate.Context) []error
type OutputConfig ¶
type OutputConfig struct {
OutputDir string `mapstructure:"output_directory"`
}
func (*OutputConfig) Prepare ¶
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error
type RunConfig ¶
type SSHConfig ¶
type SSHConfig struct { Comm communicator.Config `mapstructure:",squash"` SSHHostPortMin uint `mapstructure:"ssh_host_port_min"` SSHHostPortMax uint `mapstructure:"ssh_host_port_max"` SSHSkipNatMapping bool `mapstructure:"ssh_skip_nat_mapping"` // These are deprecated, but we keep them around for BC // TODO(@mitchellh): remove SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"` }
type ShutdownConfig ¶
type ShutdownConfig struct { ShutdownCommand string `mapstructure:"shutdown_command"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` RawPostShutdownDelay string `mapstructure:"post_shutdown_delay"` ShutdownTimeout time.Duration `` PostShutdownDelay time.Duration `` }
func (*ShutdownConfig) Prepare ¶
func (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error
type StepAttachFloppy ¶
type StepAttachFloppy struct {
// contains filtered or unexported fields
}
This step attaches the ISO to the virtual machine.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
func (*StepAttachFloppy) Cleanup ¶
func (s *StepAttachFloppy) Cleanup(state multistep.StateBag)
func (*StepAttachFloppy) Run ¶
func (s *StepAttachFloppy) Run(state multistep.StateBag) multistep.StepAction
type StepAttachGuestAdditions ¶ added in v0.6.1
type StepAttachGuestAdditions struct { GuestAdditionsMode string // contains filtered or unexported fields }
This step attaches the VirtualBox guest additions as a inserted CD onto the virtual machine.
Uses:
config *config driver Driver guest_additions_path string ui packer.Ui vmName string
Produces:
func (*StepAttachGuestAdditions) Cleanup ¶ added in v0.6.1
func (s *StepAttachGuestAdditions) Cleanup(state multistep.StateBag)
func (*StepAttachGuestAdditions) Run ¶ added in v0.6.1
func (s *StepAttachGuestAdditions) Run(state multistep.StateBag) multistep.StepAction
type StepConfigureVRDP ¶ added in v0.9.0
This step configures the VM to enable the VRDP server on the guest machine.
Uses:
driver Driver ui packer.Ui vmName string
Produces: vrdp_port unit - The port that VRDP is configured to listen on.
func (*StepConfigureVRDP) Cleanup ¶ added in v0.9.0
func (s *StepConfigureVRDP) Cleanup(state multistep.StateBag)
func (*StepConfigureVRDP) Run ¶ added in v0.9.0
func (s *StepConfigureVRDP) Run(state multistep.StateBag) multistep.StepAction
type StepDownloadGuestAdditions ¶ added in v0.6.1
type StepDownloadGuestAdditions struct { GuestAdditionsMode string GuestAdditionsURL string GuestAdditionsSHA256 string Ctx interpolate.Context }
This step uploads a file containing the VirtualBox version, which can be useful for various provisioning reasons.
Produces:
guest_additions_path string - Path to the guest additions.
func (*StepDownloadGuestAdditions) Cleanup ¶ added in v0.6.1
func (s *StepDownloadGuestAdditions) Cleanup(state multistep.StateBag)
func (*StepDownloadGuestAdditions) Run ¶ added in v0.6.1
func (s *StepDownloadGuestAdditions) Run(state multistep.StateBag) multistep.StepAction
type StepExport ¶
type StepExport struct { Format string OutputDir string ExportOpts []string SkipNatMapping bool SkipExport bool }
This step cleans up forwarded ports and exports the VM to an OVF.
Uses:
Produces:
exportPath string - The path to the resulting export.
func (*StepExport) Cleanup ¶
func (s *StepExport) Cleanup(state multistep.StateBag)
func (*StepExport) Run ¶
func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction
type StepForwardSSH ¶
type StepForwardSSH struct { CommConfig *communicator.Config HostPortMin uint HostPortMax uint SkipNatMapping bool }
This step adds a NAT port forwarding definition so that SSH is available on the guest machine.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
func (*StepForwardSSH) Cleanup ¶
func (s *StepForwardSSH) Cleanup(state multistep.StateBag)
func (*StepForwardSSH) Run ¶
func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction
type StepOutputDir ¶
StepOutputDir sets up the output directory by creating it if it does not exist, deleting it if it does exist and we're forcing, and cleaning it up when we're done with it.
func (*StepOutputDir) Cleanup ¶
func (s *StepOutputDir) Cleanup(state multistep.StateBag)
func (*StepOutputDir) Run ¶
func (s *StepOutputDir) Run(state multistep.StateBag) multistep.StepAction
type StepRemoveDevices ¶
type StepRemoveDevices struct{}
This step removes any devices (floppy disks, ISOs, etc.) from the machine that we may have added.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
func (*StepRemoveDevices) Cleanup ¶
func (s *StepRemoveDevices) Cleanup(state multistep.StateBag)
func (*StepRemoveDevices) Run ¶
func (s *StepRemoveDevices) Run(state multistep.StateBag) multistep.StepAction
type StepRun ¶
type StepRun struct { BootWait time.Duration Headless bool // contains filtered or unexported fields }
This step starts the virtual machine.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
type StepShutdown ¶
This step shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.
Uses:
communicator packer.Communicator driver Driver ui packer.Ui vmName string
Produces:
<nothing>
func (*StepShutdown) Cleanup ¶
func (s *StepShutdown) Cleanup(state multistep.StateBag)
func (*StepShutdown) Run ¶
func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction
type StepSuppressMessages ¶
type StepSuppressMessages struct{}
This step sets some variables in VirtualBox so that annoying pop-up messages don't exist.
func (StepSuppressMessages) Cleanup ¶
func (StepSuppressMessages) Cleanup(multistep.StateBag)
func (StepSuppressMessages) Run ¶
func (StepSuppressMessages) Run(state multistep.StateBag) multistep.StepAction
type StepTypeBootCommand ¶ added in v0.7.0
type StepTypeBootCommand struct { BootCommand []string VMName string Ctx interpolate.Context }
This step "types" the boot command into the VM over VNC.
Uses:
driver Driver http_port int ui packer.Ui vmName string
Produces:
<nothing>
func (*StepTypeBootCommand) Cleanup ¶ added in v0.7.0
func (*StepTypeBootCommand) Cleanup(multistep.StateBag)
func (*StepTypeBootCommand) Run ¶ added in v0.7.0
func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
type StepUploadGuestAdditions ¶ added in v0.6.1
type StepUploadGuestAdditions struct { GuestAdditionsMode string GuestAdditionsPath string Ctx interpolate.Context }
This step uploads the guest additions ISO to the VM.
func (*StepUploadGuestAdditions) Cleanup ¶ added in v0.6.1
func (s *StepUploadGuestAdditions) Cleanup(state multistep.StateBag)
func (*StepUploadGuestAdditions) Run ¶ added in v0.6.1
func (s *StepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepAction
type StepUploadVersion ¶
type StepUploadVersion struct {
Path string
}
This step uploads a file containing the VirtualBox version, which can be useful for various provisioning reasons.
func (*StepUploadVersion) Cleanup ¶
func (s *StepUploadVersion) Cleanup(state multistep.StateBag)
func (*StepUploadVersion) Run ¶
func (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction
type StepVBoxManage ¶
type StepVBoxManage struct { Commands [][]string Ctx interpolate.Context }
This step executes additional VBoxManage commands as specified by the template.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
func (*StepVBoxManage) Cleanup ¶
func (s *StepVBoxManage) Cleanup(state multistep.StateBag)
func (*StepVBoxManage) Run ¶
func (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction
type VBox42Driver ¶
type VBox42Driver struct { // This is the path to the "VBoxManage" application. VBoxManagePath string }
func (*VBox42Driver) CreateSATAController ¶
func (d *VBox42Driver) CreateSATAController(vmName string, name string) error
func (*VBox42Driver) CreateSCSIController ¶ added in v0.8.0
func (d *VBox42Driver) CreateSCSIController(vmName string, name string) error
func (*VBox42Driver) Delete ¶
func (d *VBox42Driver) Delete(name string) error
func (*VBox42Driver) Import ¶
func (d *VBox42Driver) Import(name string, path string, flags []string) error
func (*VBox42Driver) Iso ¶ added in v0.6.1
func (d *VBox42Driver) Iso() (string, error)
func (*VBox42Driver) Stop ¶
func (d *VBox42Driver) Stop(name string) error
func (*VBox42Driver) SuppressMessages ¶
func (d *VBox42Driver) SuppressMessages() error
func (*VBox42Driver) VBoxManage ¶
func (d *VBox42Driver) VBoxManage(args ...string) error
func (*VBox42Driver) Verify ¶
func (d *VBox42Driver) Verify() error
func (*VBox42Driver) Version ¶
func (d *VBox42Driver) Version() (string, error)
type VBoxManageConfig ¶
type VBoxManageConfig struct {
VBoxManage [][]string `mapstructure:"vboxmanage"`
}
func (*VBoxManageConfig) Prepare ¶
func (c *VBoxManageConfig) Prepare(ctx *interpolate.Context) []error
type VBoxManagePostConfig ¶ added in v0.6.0
type VBoxManagePostConfig struct {
VBoxManagePost [][]string `mapstructure:"vboxmanage_post"`
}
func (*VBoxManagePostConfig) Prepare ¶ added in v0.6.0
func (c *VBoxManagePostConfig) Prepare(ctx *interpolate.Context) []error
type VBoxVersionConfig ¶
type VBoxVersionConfig struct {
VBoxVersionFile *string `mapstructure:"virtualbox_version_file"`
}
func (*VBoxVersionConfig) Prepare ¶
func (c *VBoxVersionConfig) Prepare(ctx *interpolate.Context) []error
Source Files ¶
- artifact.go
- driver.go
- driver_4_2.go
- driver_mock.go
- export_config.go
- export_opts.go
- guest_addition_modes.go
- output_config.go
- run_config.go
- shutdown_config.go
- ssh.go
- ssh_config.go
- step_attach_floppy.go
- step_attach_guest_additions.go
- step_configure_vrdp.go
- step_download_guest_additions.go
- step_export.go
- step_forward_ssh.go
- step_output_dir.go
- step_remove_devices.go
- step_run.go
- step_shutdown.go
- step_suppress_messages.go
- step_type_boot_command.go
- step_upload_guest_additions.go
- step_upload_version.go
- step_vboxmanage.go
- vbox_version_config.go
- vboxmanage_config.go
- vboxmanage_post_config.go