{"modulePath":"github.com/stackpointcloud/packer","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package common\n\nThese functions are compatible with WS 9 and 10 on \\*NIX\n\nThese functions are compatible with WS 9 and 10 on \\*NIX\n\n## Constants\n\n```go\nconst BuilderId = \"mitchellh.vmware\"\n```\nBuilderId for the local artifacts\n\n```go\nconst KeyLeftShift uint32 = 0xFFE1\n```\n\n```go\nconst VMWARE_FUSION_VERSION = \"6\"\n```\n\n```go\nconst VMWARE_PLAYER_VERSION = \"6\"\n```\n\n```go\nconst VMWARE_WS_VERSION = \"10\"\n```\n\n## Variables\n\n```go\nvar KeepFileExtensions = []string{\".nvram\", \".vmdk\", \".vmsd\", \".vmx\", \".vmxf\"}\n```\nThese are the extensions of files that are important for the function of a VMware virtual machine. Any other file is discarded as part of the build.\n\n## Functions\n\n```go\nfunc CommHost(config *SSHConfig) func(multistep.StateBag) (string, error)\n```\n\n```go\nfunc EncodeVMX(contents map[string]string) string\n```\nEncodeVMX takes a map and turns it into valid VMX contents.\n\n```go\nfunc NewLocalArtifact(dir string) (packer.Artifact, error)\n```\nNewLocalArtifact returns a VMware artifact containing the files in the given directory.\n\n```go\nfunc ParseVMX(contents string) map[string]string\n```\nParseVMX parses the keys and values from a VMX file and returns them as a Go map.\n\n```go\nfunc ReadVMX(path string) (map[string]string, error)\n```\nReadVMX takes a path to a VMX file and reads it into a k/v mapping.\n\n```go\nfunc SSHConfigFunc(config *SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)\n```\n\n```go\nfunc WriteVMX(path string, data map[string]string) (err error)\n```\nWriteVMX takes a path to a VMX file and contents in the form of a map and writes it out.\n\n## Types\n\n```go\ntype DHCPLeaseGuestLookup struct {\n\t// Driver that is being used (to find leases path)\n\tDriver Driver\n\n\t// Device that the guest is connected to.\n\tDevice string\n\n\t// MAC address of the guest.\n\tMACAddress string\n}\n```\nDHCPLeaseGuestLookup looks up the IP address of a guest using DHCP lease information from the VMware network devices.\n\n```go\nfunc (f *DHCPLeaseGuestLookup) GuestIP() (string, error)\n```\n\n```go\ntype Driver interface {\n\t// Clone clones the VMX and the disk to the destination path. The\n\t// destination is a path to the VMX file. The disk will be copied\n\t// to that same directory.\n\tClone(dst string, src string) error\n\n\t// CompactDisk compacts a virtual disk.\n\tCompactDisk(string) error\n\n\t// CreateDisk creates a virtual disk with the given size.\n\tCreateDisk(string, string, string) error\n\n\t// Checks if the VMX file at the given path is running.\n\tIsRunning(string) (bool, error)\n\n\t// CommHost returns the host address for the VM that is being\n\t// managed by this driver.\n\tCommHost(multistep.StateBag) (string, error)\n\n\t// Start starts a VM specified by the path to the VMX given.\n\tStart(string, bool) error\n\n\t// Stop stops a VM specified by the path to the VMX given.\n\tStop(string) error\n\n\t// SuppressMessages modifies the VMX or surrounding directory so that\n\t// VMware doesn't show any annoying messages.\n\tSuppressMessages(string) error\n\n\t// Get the path to the VMware ISO for the given flavor.\n\tToolsIsoPath(string) string\n\n\t// Attach the VMware tools ISO\n\tToolsInstall() error\n\n\t// Get the path to the DHCP leases file for the given device.\n\tDhcpLeasesPath(string) string\n\n\t// Verify checks to make sure that this driver should function\n\t// properly. This should check that all the files it will use\n\t// appear to exist and so on. If everything is okay, this doesn't\n\t// return an error. Otherwise, this returns an error.\n\tVerify() error\n}\n```\nA driver is able to talk to VMware, control virtual machines, etc.\n\n```go\nfunc NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error)\n```\nNewDriver returns a new driver implementation for this operating system, or an error if the driver couldn't be initialized.\n\n```go\ntype DriverConfig struct {\n\tFusionAppPath string `mapstructure:\"fusion_app_path\"`\n}\n```\n\n```go\nfunc (c *DriverConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype DriverMock struct {\n\tsync.Mutex\n\n\tCloneCalled bool\n\tCloneDst    string\n\tCloneSrc    string\n\tCloneErr    error\n\n\tCompactDiskCalled bool\n\tCompactDiskPath   string\n\tCompactDiskErr    error\n\n\tCreateDiskCalled bool\n\tCreateDiskOutput string\n\tCreateDiskSize   string\n\tCreateDiskTypeId string\n\tCreateDiskErr    error\n\n\tIsRunningCalled bool\n\tIsRunningPath   string\n\tIsRunningResult bool\n\tIsRunningErr    error\n\n\tCommHostCalled bool\n\tCommHostState  multistep.StateBag\n\tCommHostResult string\n\tCommHostErr    error\n\n\tStartCalled   bool\n\tStartPath     string\n\tStartHeadless bool\n\tStartErr      error\n\n\tStopCalled bool\n\tStopPath   string\n\tStopErr    error\n\n\tSuppressMessagesCalled bool\n\tSuppressMessagesPath   string\n\tSuppressMessagesErr    error\n\n\tToolsIsoPathCalled bool\n\tToolsIsoPathFlavor string\n\tToolsIsoPathResult string\n\n\tToolsInstallCalled bool\n\tToolsInstallErr    error\n\n\tDhcpLeasesPathCalled bool\n\tDhcpLeasesPathDevice string\n\tDhcpLeasesPathResult string\n\n\tVerifyCalled bool\n\tVerifyErr    error\n}\n```\n\n```go\nfunc (d *DriverMock) Clone(dst string, src string) error\n```\n\n```go\nfunc (d *DriverMock) CommHost(state multistep.StateBag) (string, error)\n```\n\n```go\nfunc (d *DriverMock) CompactDisk(path string) error\n```\n\n```go\nfunc (d *DriverMock) CreateDisk(output string, size string, typeId string) error\n```\n\n```go\nfunc (d *DriverMock) DhcpLeasesPath(device string) string\n```\n\n```go\nfunc (d *DriverMock) IsRunning(path string) (bool, error)\n```\n\n```go\nfunc (d *DriverMock) Start(path string, headless bool) error\n```\n\n```go\nfunc (d *DriverMock) Stop(path string) error\n```\n\n```go\nfunc (d *DriverMock) SuppressMessages(path string) error\n```\n\n```go\nfunc (d *DriverMock) ToolsInstall() error\n```\n\n```go\nfunc (d *DriverMock) ToolsIsoPath(flavor string) string\n```\n\n```go\nfunc (d *DriverMock) Verify() error\n```\n\n```go\ntype Fusion5Driver struct {\n\t// This is the path to the \"VMware Fusion.app\"\n\tAppPath string\n\n\t// SSHConfig are the SSH settings for the Fusion VM\n\tSSHConfig *SSHConfig\n}\n```\nFusion5Driver is a driver that can run VMware Fusion 5.\n\n```go\nfunc (d *Fusion5Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Fusion5Driver) CommHost(state multistep.StateBag) (string, error)\n```\n\n```go\nfunc (d *Fusion5Driver) CompactDisk(diskPath string) error\n```\n\n```go\nfunc (d *Fusion5Driver) CreateDisk(output string, size string, type_id string) error\n```\n\n```go\nfunc (d *Fusion5Driver) DhcpLeasesPath(device string) string\n```\n\n```go\nfunc (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error)\n```\n\n```go\nfunc (d *Fusion5Driver) Start(vmxPath string, headless bool) error\n```\n\n```go\nfunc (d *Fusion5Driver) Stop(vmxPath string) error\n```\n\n```go\nfunc (d *Fusion5Driver) SuppressMessages(vmxPath string) error\n```\n\n```go\nfunc (d *Fusion5Driver) ToolsInstall() error\n```\n\n```go\nfunc (d *Fusion5Driver) ToolsIsoPath(k string) string\n```\n\n```go\nfunc (d *Fusion5Driver) Verify() error\n```\n\n```go\ntype Fusion6Driver struct {\n\tFusion5Driver\n}\n```\nFusion6Driver is a driver that can run VMware Fusion 6.\n\n```go\nfunc (d *Fusion6Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Fusion6Driver) Verify() error\n```\n\n```go\ntype GuestIPFinder interface {\n\tGuestIP() (string, error)\n}\n```\nInterface to help find the IP address of a running virtual machine.\n\n```go\ntype HostIPFinder interface {\n\tHostIP() (string, error)\n}\n```\nInterface to help find the host IP that is available from within the VMware virtual machines.\n\n```go\ntype IfconfigIPFinder struct {\n\tDevice string\n}\n```\nIfconfigIPFinder finds the host IP based on the output of \\`ifconfig\\`.\n\n```go\nfunc (f *IfconfigIPFinder) HostIP() (string, error)\n```\n\n```go\ntype LocalOutputDir struct {\n\t// contains filtered or unexported fields\n}\n```\nLocalOutputDir is an OutputDir implementation where the directory is on the local machine.\n\n```go\nfunc (d *LocalOutputDir) DirExists() (bool, error)\n```\n\n```go\nfunc (d *LocalOutputDir) ListFiles() ([]string, error)\n```\n\n```go\nfunc (d *LocalOutputDir) MkdirAll() error\n```\n\n```go\nfunc (d *LocalOutputDir) Remove(path string) error\n```\n\n```go\nfunc (d *LocalOutputDir) RemoveAll() error\n```\n\n```go\nfunc (d *LocalOutputDir) SetOutputDir(path string)\n```\n\n```go\nfunc (d *LocalOutputDir) String() string\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 OutputDir interface {\n\tDirExists() (bool, error)\n\tListFiles() ([]string, error)\n\tMkdirAll() error\n\tRemove(string) error\n\tRemoveAll() error\n\tSetOutputDir(string)\n\tString() string\n}\n```\nOutputDir is an interface type that abstracts the creation and handling of the output directory for VMware-based products. The abstraction is made so that the output directory can be properly made on remote (ESXi) based VMware products as well as local.\n\n```go\ntype Player5Driver struct {\n\tAppPath          string\n\tVdiskManagerPath string\n\tQemuImgPath      string\n\tVmrunPath        string\n\n\t// SSHConfig are the SSH settings for the Fusion VM\n\tSSHConfig *SSHConfig\n}\n```\nPlayer5Driver is a driver that can run VMware Player 5 on Linux.\n\n```go\nfunc (d *Player5Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Player5Driver) CommHost(state multistep.StateBag) (string, error)\n```\n\n```go\nfunc (d *Player5Driver) CompactDisk(diskPath string) error\n```\n\n```go\nfunc (d *Player5Driver) CreateDisk(output string, size string, type_id string) error\n```\n\n```go\nfunc (d *Player5Driver) DhcpLeasesPath(device string) string\n```\n\n```go\nfunc (d *Player5Driver) IsRunning(vmxPath string) (bool, error)\n```\n\n```go\nfunc (d *Player5Driver) Start(vmxPath string, headless bool) error\n```\n\n```go\nfunc (d *Player5Driver) Stop(vmxPath string) error\n```\n\n```go\nfunc (d *Player5Driver) SuppressMessages(vmxPath string) error\n```\n\n```go\nfunc (d *Player5Driver) ToolsInstall() error\n```\n\n```go\nfunc (d *Player5Driver) ToolsIsoPath(flavor string) string\n```\n\n```go\nfunc (d *Player5Driver) Verify() error\n```\n\n```go\nfunc (d *Player5Driver) VmnetnatConfPath() string\n```\n\n```go\ntype Player6Driver struct {\n\tPlayer5Driver\n}\n```\n\n```go\nfunc (d *Player6Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Player6Driver) Verify() error\n```\n\n```go\ntype RunConfig struct {\n\tHeadless    bool   `mapstructure:\"headless\"`\n\tRawBootWait string `mapstructure:\"boot_wait\"`\n\n\tVNCPortMin uint `mapstructure:\"vnc_port_min\"`\n\tVNCPortMax uint `mapstructure:\"vnc_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\t// These are deprecated, but we keep them around for BC\n\t// TODO(@mitchellh): remove\n\tSSHSkipRequestPty bool          `mapstructure:\"ssh_skip_request_pty\"`\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 StepCleanFiles struct{}\n```\nThis step removes unnecessary files from the final result.\n\nUses:\n\n\tdir    OutputDir\n\tui     packer.Ui\n\nProduces:\n\n\t\u003cnothing\u003e\n\n```go\nfunc (StepCleanFiles) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (StepCleanFiles) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepCleanVMX struct{}\n```\nThis step cleans up the VMX by removing or changing this prior to being ready for use.\n\nUses:\n\n\tui     packer.Ui\n\tvmx_path string\n\nProduces:\n\n\t\u003cnothing\u003e\n\n```go\nfunc (StepCleanVMX) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s StepCleanVMX) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepCompactDisk struct {\n\tSkip bool\n}\n```\nThis step compacts the virtual disk for the VM unless the \"skip\\_compaction\" boolean is true.\n\nUses:\n\n\tdriver Driver\n\tfull_disk_path string\n\tui     packer.Ui\n\nProduces:\n\n\t\u003cnothing\u003e\n\n```go\nfunc (StepCompactDisk) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepConfigureVMX struct {\n\tCustomData map[string]string\n\tSkipFloppy bool\n}\n```\nThis step configures a VMX by setting some default settings as well as taking in custom data to set, attaching a floppy if it exists, etc.\n\nUses:\n\n\tvmx_path string\n\n```go\nfunc (s *StepConfigureVMX) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepConfigureVNC struct {\n\tVNCPortMin uint\n\tVNCPortMax uint\n}\n```\nThis step configures the VM to enable the VNC server.\n\nUses:\n\n\tui     packer.Ui\n\tvmx_path string\n\nProduces:\n\n\tvnc_port uint - The port that VNC is configured to listen on.\n\n```go\nfunc (StepConfigureVNC) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s *StepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\nfunc (StepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint, error)\n```\n\n```go\ntype StepOutputDir struct {\n\tForce bool\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 StepPrepareTools struct {\n\tRemoteType        string\n\tToolsUploadFlavor string\n}\n```\n\n```go\nfunc (c *StepPrepareTools) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (c *StepPrepareTools) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepRun struct {\n\tBootWait           time.Duration\n\tDurationBeforeStop time.Duration\n\tHeadless           bool\n\t// contains filtered or unexported fields\n}\n```\nThis step runs the created virtual machine.\n\nUses:\n\n\tdriver Driver\n\tui     packer.Ui\n\tvmx_path string\n\nProduces:\n\n\t\u003cnothing\u003e\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\t// Set this to true if we're testing\n\tTesting bool\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\tdir OutputDir\n\tdriver Driver\n\tui     packer.Ui\n\tvmx_path 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 suppresses any messages that VMware product might show.\n\n```go\nfunc (s *StepSuppressMessages) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *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\thttp_port int\n\tui     packer.Ui\n\tvnc_port uint\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 StepUploadTools struct {\n\tRemoteType        string\n\tToolsUploadFlavor string\n\tToolsUploadPath   string\n\tCtx               interpolate.Context\n}\n```\n\n```go\nfunc (c *StepUploadTools) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (c *StepUploadTools) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype ToolsConfig struct {\n\tToolsUploadFlavor string `mapstructure:\"tools_upload_flavor\"`\n\tToolsUploadPath   string `mapstructure:\"tools_upload_path\"`\n}\n```\n\n```go\nfunc (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype VMXConfig struct {\n\tVMXData     map[string]string `mapstructure:\"vmx_data\"`\n\tVMXDataPost map[string]string `mapstructure:\"vmx_data_post\"`\n}\n```\n\n```go\nfunc (c *VMXConfig) Prepare(ctx *interpolate.Context) []error\n```\n\n```go\ntype VMnetNatConfIPFinder struct{}\n```\nVMnetNatConfIPFinder finds the IP address of the host machine by retrieving the IP from the vmnetnat.conf. This isn't a full proof technique but so far it has not failed.\n\n```go\nfunc (*VMnetNatConfIPFinder) HostIP() (string, error)\n```\n\n```go\ntype VNCAddressFinder interface {\n\tVNCAddress(uint, uint) (string, uint, error)\n}\n```\n\n```go\ntype Workstation10Driver struct {\n\tWorkstation9Driver\n}\n```\n\n```go\nfunc (d *Workstation10Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Workstation10Driver) Verify() error\n```\n\n```go\ntype Workstation9Driver struct {\n\tAppPath          string\n\tVdiskManagerPath string\n\tVmrunPath        string\n\n\t// SSHConfig are the SSH settings for the Fusion VM\n\tSSHConfig *SSHConfig\n}\n```\nWorkstation9Driver is a driver that can run VMware Workstation 9\n\n```go\nfunc (d *Workstation9Driver) Clone(dst, src string) error\n```\n\n```go\nfunc (d *Workstation9Driver) CommHost(state multistep.StateBag) (string, error)\n```\n\n```go\nfunc (d *Workstation9Driver) CompactDisk(diskPath string) error\n```\n\n```go\nfunc (d *Workstation9Driver) CreateDisk(output string, size string, type_id string) error\n```\n\n```go\nfunc (d *Workstation9Driver) DhcpLeasesPath(device string) string\n```\n\n```go\nfunc (d *Workstation9Driver) IsRunning(vmxPath string) (bool, error)\n```\n\n```go\nfunc (d *Workstation9Driver) Start(vmxPath string, headless bool) error\n```\n\n```go\nfunc (d *Workstation9Driver) Stop(vmxPath string) error\n```\n\n```go\nfunc (d *Workstation9Driver) SuppressMessages(vmxPath string) error\n```\n\n```go\nfunc (d *Workstation9Driver) ToolsInstall() error\n```\n\n```go\nfunc (d *Workstation9Driver) ToolsIsoPath(flavor string) string\n```\n\n```go\nfunc (d *Workstation9Driver) Verify() error\n```\n\n```go\nfunc (d *Workstation9Driver) VmnetnatConfPath() string\n```\n\n","path":"github.com/stackpointcloud/packer/builder/vmware/common","name":"common","synopsis":"These functions are compatible with WS 9 and 10 on *NIX These functions are compatible with WS 9 and 10 on *NIX","isRedistributable":true}
