{"modulePath":"github.com/stackpointcloud/packer","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package common\n\n## Constants\n\n```go\nconst (\n\tGuestAdditionsModeDisable string = \"disable\"\n\tGuestAdditionsModeAttach         = \"attach\"\n\tGuestAdditionsModeUpload         = \"upload\"\n)\n```\nThese are the different valid mode values for \"guest\\_additions\\_mode\" which determine how guest additions are delivered to the guest.\n\n```go\nconst BuilderId = \"mitchellh.virtualbox\"\n```\nThis is the common builder ID to all of these artifacts.\n\n```go\nconst KeyLeftShift uint32 = 0xFFE1\n```\n\n## Functions\n\n```go\nfunc CommHost(state multistep.StateBag) (string, error)\n```\n\n```go\nfunc NewArtifact(dir string) (packer.Artifact, error)\n```\nNewArtifact returns a VirtualBox artifact containing the files in the given directory.\n\n```go\nfunc SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)\n```\n\n```go\nfunc SSHPort(state multistep.StateBag) (int, error)\n```\n\n## Types\n\n```go\ntype Driver interface {\n\t// Create a SATA controller.\n\tCreateSATAController(vm string, controller string) error\n\n\t// Create a SCSI controller.\n\tCreateSCSIController(vm string, controller string) error\n\n\t// Delete a VM by name\n\tDelete(string) error\n\n\t// Import a VM\n\tImport(string, string, []string) error\n\n\t// The complete path to the Guest Additions ISO\n\tIso() (string, error)\n\n\t// Checks if the VM with the given name is running.\n\tIsRunning(string) (bool, error)\n\n\t// Stop stops a running machine, forcefully.\n\tStop(string) error\n\n\t// SuppressMessages should do what needs to be done in order to\n\t// suppress any annoying popups from VirtualBox.\n\tSuppressMessages() error\n\n\t// VBoxManage executes the given VBoxManage command\n\tVBoxManage(...string) error\n\n\t// Verify checks to make sure that this driver should function\n\t// properly. If there is any indication the driver can't function,\n\t// this will return an error.\n\tVerify() error\n\n\t// Version reads the version of VirtualBox that is installed.\n\tVersion() (string, error)\n}\n```\nA 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.\n\n```go\nfunc NewDriver() (Driver, error)\n```\n\n```go\ntype DriverMock struct {\n\tsync.Mutex\n\n\tCreateSATAControllerVM         string\n\tCreateSATAControllerController string\n\tCreateSATAControllerErr        error\n\n\tCreateSCSIControllerVM         string\n\tCreateSCSIControllerController string\n\tCreateSCSIControllerErr        error\n\n\tDeleteCalled bool\n\tDeleteName   string\n\tDeleteErr    error\n\n\tImportCalled bool\n\tImportName   string\n\tImportPath   string\n\tImportFlags  []string\n\tImportErr    error\n\n\tIsoCalled bool\n\tIsoErr    error\n\n\tIsRunningName   string\n\tIsRunningReturn bool\n\tIsRunningErr    error\n\n\tStopName string\n\tStopErr  error\n\n\tSuppressMessagesCalled bool\n\tSuppressMessagesErr    error\n\n\tVBoxManageCalls [][]string\n\tVBoxManageErrs  []error\n\n\tVerifyCalled bool\n\tVerifyErr    error\n\n\tVersionCalled bool\n\tVersionResult string\n\tVersionErr    error\n}\n```\n\n```go\nfunc (d *DriverMock) CreateSATAController(vm string, controller string) error\n```\n\n```go\nfunc (d *DriverMock) CreateSCSIController(vm string, controller string) error\n```\n\n```go\nfunc (d *DriverMock) Delete(name string) error\n```\n\n```go\nfunc (d *DriverMock) Import(name string, path string, flags []string) error\n```\n\n```go\nfunc (d *DriverMock) IsRunning(name string) (bool, error)\n```\n\n```go\nfunc (d *DriverMock) Iso() (string, error)\n```\n\n```go\nfunc (d *DriverMock) Stop(name string) error\n```\n\n```go\nfunc (d *DriverMock) SuppressMessages() error\n```\n\n```go\nfunc (d *DriverMock) VBoxManage(args ...string) error\n```\n\n```go\nfunc (d *DriverMock) Verify() error\n```\n\n```go\nfunc (d *DriverMock) Version() (string, error)\n```\n\n```go\ntype ExportConfig struct {\n\tFormat string `mapstruture:\"format\"`\n}\n```\n\n```go\nfunc (c *ExportConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype ExportOpts struct {\n\tExportOpts []string `mapstructure:\"export_opts\"`\n}\n```\n\n```go\nfunc (c *ExportOpts) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype FloppyConfig struct {\n\tFloppyFiles []string `mapstructure:\"floppy_files\"`\n}\n```\nFloppyConfig is configuration related to created floppy disks and attaching them to a VirtualBox machine.\n\n```go\nfunc (c *FloppyConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype OutputConfig struct {\n\tOutputDir string `mapstructure:\"output_directory\"`\n}\n```\n\n```go\nfunc (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error\n```\n\n```go\ntype RunConfig struct {\n\tHeadless    bool   `mapstructure:\"headless\"`\n\tRawBootWait string `mapstructure:\"boot_wait\"`\n\n\tVRDPPortMin uint `mapstructure:\"vrdp_port_min\"`\n\tVRDPPortMax uint `mapstructure:\"vrdp_port_max\"`\n\n\tBootWait time.Duration ``\n}\n```\n\n```go\nfunc (c *RunConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype SSHConfig struct {\n\tComm communicator.Config `mapstructure:\",squash\"`\n\n\tSSHHostPortMin    uint `mapstructure:\"ssh_host_port_min\"`\n\tSSHHostPortMax    uint `mapstructure:\"ssh_host_port_max\"`\n\tSSHSkipNatMapping bool `mapstructure:\"ssh_skip_nat_mapping\"`\n\n\t// These are deprecated, but we keep them around for BC\n\t// TODO(@mitchellh): remove\n\tSSHWaitTimeout time.Duration `mapstructure:\"ssh_wait_timeout\"`\n}\n```\n\n```go\nfunc (c *SSHConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype ShutdownConfig struct {\n\tShutdownCommand    string `mapstructure:\"shutdown_command\"`\n\tRawShutdownTimeout string `mapstructure:\"shutdown_timeout\"`\n\n\tShutdownTimeout time.Duration ``\n}\n```\n\n```go\nfunc (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype StepAttachFloppy struct {\n\t// contains filtered or unexported fields\n}\n```\nThis step attaches the ISO to the virtual machine.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepAttachFloppy) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepAttachFloppy) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepAttachGuestAdditions struct {\n\tGuestAdditionsMode string\n\t// contains filtered or unexported fields\n}\n```\nThis step attaches the VirtualBox guest additions as a inserted CD onto the virtual machine.\n\nUses:\n\n\tconfig *config\n\tdriver Driver\n\tguest_additions_path string\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepAttachGuestAdditions) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepAttachGuestAdditions) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepConfigureVRDP struct {\n\tVRDPPortMin uint\n\tVRDPPortMax uint\n}\n```\nThis step configures the VM to enable the VRDP server on the guest machine.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces: vrdp\\_port unit - The port that VRDP is configured to listen on.\n\n```go\nfunc (s *StepConfigureVRDP) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepConfigureVRDP) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepDownloadGuestAdditions struct {\n\tGuestAdditionsMode   string\n\tGuestAdditionsURL    string\n\tGuestAdditionsSHA256 string\n\tCtx                  interpolate.Context\n}\n```\nThis step uploads a file containing the VirtualBox version, which can be useful for various provisioning reasons.\n\nProduces:\n\n\tguest_additions_path string - Path to the guest additions.\n\n```go\nfunc (s *StepDownloadGuestAdditions) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepDownloadGuestAdditions) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepExport struct {\n\tFormat         string\n\tOutputDir      string\n\tExportOpts     []string\n\tSkipNatMapping bool\n}\n```\nThis step cleans up forwarded ports and exports the VM to an OVF.\n\nUses:\n\nProduces:\n\n\texportPath string - The path to the resulting export.\n\n```go\nfunc (s *StepExport) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepExport) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepForwardSSH struct {\n\tCommConfig     *communicator.Config\n\tHostPortMin    uint\n\tHostPortMax    uint\n\tSkipNatMapping bool\n}\n```\nThis step adds a NAT port forwarding definition so that SSH is available on the guest machine.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepForwardSSH) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepOutputDir struct {\n\tForce bool\n\tPath  string\n\t// contains filtered or unexported fields\n}\n```\nStepOutputDir 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.\n\n```go\nfunc (s *StepOutputDir) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepOutputDir) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepRemoveDevices struct{}\n```\nThis step removes any devices (floppy disks, ISOs, etc.) from the machine that we may have added.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepRemoveDevices) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepRemoveDevices) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepRun struct {\n\tBootWait time.Duration\n\tHeadless bool\n\t// contains filtered or unexported fields\n}\n```\nThis step starts the virtual machine.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepRun) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepRun) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepShutdown struct {\n\tCommand string\n\tTimeout time.Duration\n}\n```\nThis step shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.\n\nUses:\n\n\tcommunicator packer.Communicator\n\tdriver Driver\n\tui     packer.Ui\n\tvmName string\n\nProduces:\n\n\t\u003cnothing\u003e\n\n```go\nfunc (s *StepShutdown) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepSuppressMessages struct{}\n```\nThis step sets some variables in VirtualBox so that annoying pop-up messages don't exist.\n\n```go\nfunc (StepSuppressMessages) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (StepSuppressMessages) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepTypeBootCommand struct {\n\tBootCommand []string\n\tVMName      string\n\tCtx         interpolate.Context\n}\n```\nThis step \"types\" the boot command into the VM over VNC.\n\nUses:\n\n\tdriver Driver\n\thttp_port int\n\tui     packer.Ui\n\tvmName string\n\nProduces:\n\n\t\u003cnothing\u003e\n\n```go\nfunc (*StepTypeBootCommand) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepUploadGuestAdditions struct {\n\tGuestAdditionsMode string\n\tGuestAdditionsPath string\n\tCtx                interpolate.Context\n}\n```\nThis step uploads the guest additions ISO to the VM.\n\n```go\nfunc (s *StepUploadGuestAdditions) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepUploadVersion struct {\n\tPath string\n}\n```\nThis step uploads a file containing the VirtualBox version, which can be useful for various provisioning reasons.\n\n```go\nfunc (s *StepUploadVersion) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepVBoxManage struct {\n\tCommands [][]string\n\tCtx      interpolate.Context\n}\n```\nThis step executes additional VBoxManage commands as specified by the template.\n\nUses:\n\n\tdriver Driver\n\tui packer.Ui\n\tvmName string\n\nProduces:\n\n```go\nfunc (s *StepVBoxManage) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype VBox42Driver struct {\n\t// This is the path to the \"VBoxManage\" application.\n\tVBoxManagePath string\n}\n```\n\n```go\nfunc (d *VBox42Driver) CreateSATAController(vmName string, name string) error\n```\n\n```go\nfunc (d *VBox42Driver) CreateSCSIController(vmName string, name string) error\n```\n\n```go\nfunc (d *VBox42Driver) Delete(name string) error\n```\n\n```go\nfunc (d *VBox42Driver) Import(name string, path string, flags []string) error\n```\n\n```go\nfunc (d *VBox42Driver) IsRunning(name string) (bool, error)\n```\n\n```go\nfunc (d *VBox42Driver) Iso() (string, error)\n```\n\n```go\nfunc (d *VBox42Driver) Stop(name string) error\n```\n\n```go\nfunc (d *VBox42Driver) SuppressMessages() error\n```\n\n```go\nfunc (d *VBox42Driver) VBoxManage(args ...string) error\n```\n\n```go\nfunc (d *VBox42Driver) Verify() error\n```\n\n```go\nfunc (d *VBox42Driver) Version() (string, error)\n```\n\n```go\ntype VBoxManageConfig struct {\n\tVBoxManage [][]string `mapstructure:\"vboxmanage\"`\n}\n```\n\n```go\nfunc (c *VBoxManageConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype VBoxManagePostConfig struct {\n\tVBoxManagePost [][]string `mapstructure:\"vboxmanage_post\"`\n}\n```\n\n```go\nfunc (c *VBoxManagePostConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype VBoxVersionConfig struct {\n\tVBoxVersionFile string `mapstructure:\"virtualbox_version_file\"`\n}\n```\n\n```go\nfunc (c *VBoxVersionConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n","path":"github.com/stackpointcloud/packer/builder/virtualbox/common","name":"common","synopsis":"","isRedistributable":true}
