Documentation ¶
Index ¶
- Constants
- func CommHost(host string) func(multistep.StateBag) (string, error)
- func NewArtifact(dir string, generatedData map[string]interface{}) (packersdk.Artifact, error)
- type Driver
- type DriverMock
- func (d *DriverMock) CompactDisk(path string) error
- func (d *DriverMock) DeviceAddCDROM(name string, image string) (string, error)
- func (d *DriverMock) DiskPath(name string) (string, error)
- func (d *DriverMock) IPAddress(mac string) (string, error)
- func (d *DriverMock) Import(name, srcPath, dstPath string, reassignMAC bool) error
- func (d *DriverMock) IsRunning(name string) (bool, error)
- func (d *DriverMock) MAC(name string) (string, error)
- func (d *DriverMock) Prlctl(args ...string) error
- func (d *DriverMock) SendKeyScanCodes(name string, scancodes ...string) error
- func (d *DriverMock) SetDefaultConfiguration(name string) error
- func (d *DriverMock) Stop(name string) error
- func (d *DriverMock) ToolsISOPath(flavor string) (string, error)
- func (d *DriverMock) Verify() error
- func (d *DriverMock) Version() (string, error)
- type HWConfig
- type HostIPFinder
- type IfconfigIPFinder
- type OutputConfig
- type Parallels10Driver
- type Parallels11Driver
- type Parallels9Driver
- func (d *Parallels9Driver) CompactDisk(diskPath string) error
- func (d *Parallels9Driver) DeviceAddCDROM(name string, image string) (string, error)
- func (d *Parallels9Driver) DiskPath(name string) (string, error)
- func (d *Parallels9Driver) IPAddress(mac string) (string, error)
- func (d *Parallels9Driver) Import(name, srcPath, dstDir string, reassignMAC bool) error
- func (d *Parallels9Driver) IsRunning(name string) (bool, error)
- func (d *Parallels9Driver) MAC(vmName string) (string, error)
- func (d *Parallels9Driver) Prlctl(args ...string) error
- func (d *Parallels9Driver) SendKeyScanCodes(vmName string, codes ...string) error
- func (d *Parallels9Driver) SetDefaultConfiguration(vmName string) error
- func (d *Parallels9Driver) Stop(name string) error
- func (d *Parallels9Driver) ToolsISOPath(k string) (string, error)
- func (d *Parallels9Driver) Verify() error
- func (d *Parallels9Driver) Version() (string, error)
- type PrlctlConfig
- type PrlctlPostConfig
- type PrlctlVersionConfig
- type SSHConfig
- type StepAttachFloppy
- type StepAttachParallelsTools
- type StepCompactDisk
- type StepOutputDir
- type StepPrepareParallelsTools
- type StepPrlctl
- type StepRun
- type StepShutdown
- type StepTypeBootCommand
- type StepUploadParallelsTools
- type StepUploadVersion
- type ToolsConfig
Constants ¶
const ( ParallelsToolsModeDisable string = "disable" ParallelsToolsModeAttach = "attach" ParallelsToolsModeUpload = "upload" )
These are the different valid mode values for "parallels_tools_mode" which determine how guest additions are delivered to the guest.
const BuilderId = "packer.parallels"
BuilderId is the common builder ID to all of these artifacts.
const Prltype string = `` /* 1593-byte string literal not displayed */
Prltype is a Python scrypt allowin to send scancodes to the VM. It requires the module "prlsdkapi", which is bundled to Parallels Virtualization SDK.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
type Driver interface { // Compact a virtual disk image. CompactDisk(string) error // Adds new CD/DVD drive to the VM and returns name of this device DeviceAddCDROM(string, string) (string, error) // Get path to the first virtual disk image DiskPath(string) (string, error) // Import a VM Import(string, string, string, bool) error // Checks if the VM with the given name is running. IsRunning(string) (bool, error) // Stop stops a running machine, forcefully. Stop(string) error // Prlctl executes the given Prlctl command Prlctl(...string) error // Get the path to the Parallels Tools ISO for the given flavor. ToolsISOPath(string) (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 Parallels that is installed. Version() (string, error) // Send scancodes to the vm using the prltype python script. SendKeyScanCodes(string, ...string) error // Apply default configuration settings to the virtual machine SetDefaultConfiguration(string) error // Finds the MAC address of the NIC nic0 MAC(string) (string, error) // Finds the IP address of a VM connected that uses DHCP by its MAC address IPAddress(string) (string, error) }
Driver is the interface that talks to Parallels and performs 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 Parallels 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 CompactDiskCalled bool CompactDiskPath string CompactDiskErr error DeviceAddCDROMCalled bool DeviceAddCDROMName string DeviceAddCDROMImage string DeviceAddCDROMResult string DeviceAddCDROMErr error DiskPathCalled bool DiskPathName string DiskPathResult string DiskPathErr error ImportCalled bool ImportName string ImportSrcPath string ImportDstPath string ImportErr error IsRunningName string IsRunningReturn bool IsRunningErr error StopName string StopErr error PrlctlCalls [][]string PrlctlErrs []error VerifyCalled bool VerifyErr error VersionCalled bool VersionResult string VersionErr error SendKeyScanCodesCalls [][]string SendKeyScanCodesErrs []error SetDefaultConfigurationCalled bool SetDefaultConfigurationError error ToolsISOPathCalled bool ToolsISOPathFlavor string ToolsISOPathResult string ToolsISOPathErr error MACName string MACReturn string MACError error IPAddressMAC string IPAddressReturn string IPAddressError error }
func (*DriverMock) CompactDisk ¶ added in v0.9.0
func (d *DriverMock) CompactDisk(path string) error
func (*DriverMock) DeviceAddCDROM ¶ added in v0.12.2
func (d *DriverMock) DeviceAddCDROM(name string, image string) (string, error)
func (*DriverMock) DiskPath ¶ added in v0.9.0
func (d *DriverMock) DiskPath(name string) (string, error)
func (*DriverMock) IPAddress ¶ added in v0.12.2
func (d *DriverMock) IPAddress(mac string) (string, error)
func (*DriverMock) Import ¶
func (d *DriverMock) Import(name, srcPath, dstPath string, reassignMAC bool) error
func (*DriverMock) Prlctl ¶
func (d *DriverMock) Prlctl(args ...string) error
func (*DriverMock) SendKeyScanCodes ¶
func (d *DriverMock) SendKeyScanCodes(name string, scancodes ...string) error
func (*DriverMock) SetDefaultConfiguration ¶ added in v0.8.0
func (d *DriverMock) SetDefaultConfiguration(name string) error
func (*DriverMock) Stop ¶
func (d *DriverMock) Stop(name string) error
func (*DriverMock) ToolsISOPath ¶ added in v0.12.2
func (d *DriverMock) ToolsISOPath(flavor string) (string, error)
func (*DriverMock) Verify ¶
func (d *DriverMock) Verify() error
func (*DriverMock) Version ¶
func (d *DriverMock) Version() (string, error)
type HWConfig ¶ added in v1.3.3
type HWConfig struct { // The number of cpus to use for building the VM. // Defaults to 1. CpuCount int `mapstructure:"cpus" required:"false"` // The amount of memory to use for building the VM in // megabytes. Defaults to 512 megabytes. MemorySize int `mapstructure:"memory" required:"false"` // Specifies whether to enable the sound device when // building the VM. Defaults to false. Sound bool `mapstructure:"sound" required:"false"` // Specifies whether to enable the USB bus when building // the VM. Defaults to false. USB bool `mapstructure:"usb" required:"false"` }
type HostIPFinder ¶ added in v0.6.1
HostIPFinder allows to find the host IP that is available from within the Parallels virtual machines.
type IfconfigIPFinder ¶ added in v0.6.1
type IfconfigIPFinder struct {
Devices []string
}
IfconfigIPFinder finds the host IP based on the output of `ifconfig`.
func (*IfconfigIPFinder) HostIP ¶ added in v0.6.1
func (f *IfconfigIPFinder) HostIP() (string, error)
HostIP returns the host's IP address or an error if it could not be found from the `ifconfig` output.
type OutputConfig ¶
type OutputConfig struct { // This is the path to the directory where the // resulting virtual machine will be created. This may be relative or absolute. // If relative, the path is relative to the working directory when packer // is executed. This directory must not exist or be empty prior to running // the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the // name of the build. OutputDir string `mapstructure:"output_directory" required:"false"` }
OutputConfig contains the configuration for builder's output.
func (*OutputConfig) Prepare ¶
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error
Prepare configures the output directory or returns an error if it already exists.
type Parallels10Driver ¶ added in v0.7.0
type Parallels10Driver struct {
Parallels9Driver
}
Parallels10Driver are inherited from Parallels9Driver.
func (*Parallels10Driver) SetDefaultConfiguration ¶ added in v0.8.0
func (d *Parallels10Driver) SetDefaultConfiguration(vmName string) error
SetDefaultConfiguration applies pre-defined default settings to the VM config.
type Parallels11Driver ¶ added in v0.9.0
type Parallels11Driver struct {
Parallels9Driver
}
Parallels11Driver are inherited from Parallels9Driver. Used for Parallels Desktop 11, requires Pro or Business Edition
func (*Parallels11Driver) SetDefaultConfiguration ¶ added in v0.9.0
func (d *Parallels11Driver) SetDefaultConfiguration(vmName string) error
SetDefaultConfiguration applies pre-defined default settings to the VM config.
func (*Parallels11Driver) Verify ¶ added in v0.9.0
func (d *Parallels11Driver) Verify() error
Verify raises an error if the builder could not be used on that host machine.
type Parallels9Driver ¶
type Parallels9Driver struct { // This is the path to the "prlctl" application. PrlctlPath string // This is the path to the "prlsrvctl" application. PrlsrvctlPath string // contains filtered or unexported fields }
Parallels9Driver is a base type for Parallels builders.
func (*Parallels9Driver) CompactDisk ¶ added in v0.9.0
func (d *Parallels9Driver) CompactDisk(diskPath string) error
CompactDisk performs the compaction of the specified virtual disk image.
func (*Parallels9Driver) DeviceAddCDROM ¶ added in v0.12.2
func (d *Parallels9Driver) DeviceAddCDROM(name string, image string) (string, error)
DeviceAddCDROM adds a virtual CDROM device and attaches the specified image.
func (*Parallels9Driver) DiskPath ¶ added in v0.9.0
func (d *Parallels9Driver) DiskPath(name string) (string, error)
DiskPath returns a full path to the first virtual disk drive.
func (*Parallels9Driver) IPAddress ¶ added in v0.12.2
func (d *Parallels9Driver) IPAddress(mac string) (string, error)
IPAddress finds the IP address of a VM connected that uses DHCP by its MAC address
Parses the file /Library/Preferences/Parallels/parallels_dhcp_leases file contain a list of DHCP leases given by Parallels Desktop Example line: 10.211.55.181="1418921112,1800,001c42f593fb,ff42f593fb000100011c25b9ff001c42f593fb" IP Address ="Lease expiry, Lease time, MAC, MAC or DUID"
func (*Parallels9Driver) Import ¶
func (d *Parallels9Driver) Import(name, srcPath, dstDir string, reassignMAC bool) error
Import creates a clone of the source VM and reassigns the MAC address if needed.
func (*Parallels9Driver) IsRunning ¶
func (d *Parallels9Driver) IsRunning(name string) (bool, error)
IsRunning determines whether the VM is running or not.
func (*Parallels9Driver) MAC ¶ added in v0.12.2
func (d *Parallels9Driver) MAC(vmName string) (string, error)
MAC returns the MAC address of the VM's first network interface.
func (*Parallels9Driver) Prlctl ¶
func (d *Parallels9Driver) Prlctl(args ...string) error
Prlctl executes the specified "prlctl" command.
func (*Parallels9Driver) SendKeyScanCodes ¶
func (d *Parallels9Driver) SendKeyScanCodes(vmName string, codes ...string) error
SendKeyScanCodes sends the specified scancodes as key events to the VM. It is performed using "Prltype" script (refer to "prltype.go").
func (*Parallels9Driver) SetDefaultConfiguration ¶ added in v0.8.0
func (d *Parallels9Driver) SetDefaultConfiguration(vmName string) error
SetDefaultConfiguration applies pre-defined default settings to the VM config.
func (*Parallels9Driver) Stop ¶
func (d *Parallels9Driver) Stop(name string) error
Stop forcibly stops the VM.
func (*Parallels9Driver) ToolsISOPath ¶ added in v0.12.2
func (d *Parallels9Driver) ToolsISOPath(k string) (string, error)
ToolsISOPath returns a full path to the Parallels Tools ISO for the specified guest OS type. The following OS types are supported: "win", "lin", "mac", "other".
func (*Parallels9Driver) Verify ¶
func (d *Parallels9Driver) Verify() error
Verify raises an error if the builder could not be used on that host machine.
func (*Parallels9Driver) Version ¶
func (d *Parallels9Driver) Version() (string, error)
Version returns the version of Parallels Desktop installed on that host.
type PrlctlConfig ¶
type PrlctlConfig struct { // Custom prlctl commands to execute // in order to further customize the virtual machine being created. The value // of this is an array of commands to execute. The commands are executed in the // order defined in the template. For each command, the command is defined // itself as an array of strings, where each string represents a single // argument on the command-line to prlctl (but excluding prlctl itself). // Each arg is treated as a configuration // template, where the Name // variable is replaced with the VM name. More details on how to use prlctl // are below. Prlctl [][]string `mapstructure:"prlctl" required:"false"` }
PrlctlConfig contains the configuration for running "prlctl" commands before the VM start.
func (*PrlctlConfig) Prepare ¶
func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error
Prepare sets the default value of "Prlctl" property.
type PrlctlPostConfig ¶ added in v0.8.0
type PrlctlPostConfig struct { // Identical to prlctl, except // that it is run after the virtual machine is shutdown, and before the virtual // machine is exported. PrlctlPost [][]string `mapstructure:"prlctl_post" required:"false"` }
PrlctlPostConfig contains the configuration for running "prlctl" commands in the end of artifact build.
func (*PrlctlPostConfig) Prepare ¶ added in v0.8.0
func (c *PrlctlPostConfig) Prepare(ctx *interpolate.Context) []error
Prepare sets the default value of "PrlctlPost" property.
type PrlctlVersionConfig ¶
type PrlctlVersionConfig struct { // The path within the virtual machine to // upload a file that contains the prlctl version that was used to create // the machine. This information can be useful for provisioning. By default // this is ".prlctl_version", which will generally upload it into the // home directory. PrlctlVersionFile string `mapstructure:"prlctl_version_file" required:"false"` }
PrlctlVersionConfig contains the configuration for `prlctl` version.
func (*PrlctlVersionConfig) Prepare ¶
func (c *PrlctlVersionConfig) Prepare(ctx *interpolate.Context) []error
Prepare sets the default value of "PrlctlVersionFile" property.
type SSHConfig ¶
type SSHConfig struct {
Comm communicator.Config `mapstructure:",squash"`
}
SSHConfig contains the configuration for SSH communicator.
type StepAttachFloppy ¶
type StepAttachFloppy struct {
// contains filtered or unexported fields
}
StepAttachFloppy is a step that attaches a floppy to the virtual machine.
Uses:
driver Driver ui packersdk.Ui vmName string
Produces:
func (*StepAttachFloppy) Cleanup ¶
func (s *StepAttachFloppy) Cleanup(state multistep.StateBag)
Cleanup removes the virtual FDD device attached to the VM.
func (*StepAttachFloppy) Run ¶
func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run adds a virtual FDD device to the VM and attaches the image. If the image is not specified, then this step will be skipped.
type StepAttachParallelsTools ¶
type StepAttachParallelsTools struct { ParallelsToolsMode string // contains filtered or unexported fields }
StepAttachParallelsTools is a step that attaches Parallels Tools ISO image as an inserted CD onto the virtual machine.
Uses:
driver Driver parallels_tools_path string ui packersdk.Ui vmName string
Produces:
func (*StepAttachParallelsTools) Cleanup ¶
func (s *StepAttachParallelsTools) Cleanup(state multistep.StateBag)
Cleanup removes the virtual CD-ROM device attached to the VM.
func (*StepAttachParallelsTools) Run ¶
func (s *StepAttachParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run adds a virtual CD-ROM device to the VM and attaches Parallels Tools ISO image. If ISO image is not specified, then this step will be skipped.
type StepCompactDisk ¶ added in v0.9.0
type StepCompactDisk struct {
Skip bool
}
StepCompactDisk is a step that removes all empty blocks from expanding Parallels virtual disks and reduces the result disk size
Uses:
driver Driver vmName string ui packersdk.Ui
Produces:
<nothing>
func (*StepCompactDisk) Cleanup ¶ added in v0.9.0
func (*StepCompactDisk) Cleanup(multistep.StateBag)
Cleanup does nothing.
func (*StepCompactDisk) Run ¶ added in v0.9.0
func (s *StepCompactDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run runs the compaction of the virtual disk attached to the VM.
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)
Cleanup deletes the output directory.
func (*StepOutputDir) Run ¶
func (s *StepOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run sets up the output directory.
type StepPrepareParallelsTools ¶ added in v0.7.0
StepPrepareParallelsTools is a step that prepares parameters related to Parallels Tools.
Uses:
driver Driver
Produces:
parallels_tools_path string
func (*StepPrepareParallelsTools) Cleanup ¶ added in v0.7.0
func (s *StepPrepareParallelsTools) Cleanup(multistep.StateBag)
Cleanup does nothing.
func (*StepPrepareParallelsTools) Run ¶ added in v0.7.0
func (s *StepPrepareParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run sets the value of "parallels_tools_path".
type StepPrlctl ¶
type StepPrlctl struct { Commands [][]string Ctx interpolate.Context }
StepPrlctl is a step that executes additional `prlctl` commands as specified. by the template.
Uses:
driver Driver ui packersdk.Ui vmName string
Produces:
func (*StepPrlctl) Cleanup ¶
func (s *StepPrlctl) Cleanup(state multistep.StateBag)
Cleanup does nothing.
func (*StepPrlctl) Run ¶
func (s *StepPrlctl) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run executes `prlctl` commands.
type StepRun ¶
type StepRun struct {
// contains filtered or unexported fields
}
StepRun is a step that starts the virtual machine.
Uses:
driver Driver ui packersdk.Ui vmName string
Produces:
type StepShutdown ¶
StepShutdown is a step that shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.
Uses:
communicator packersdk.Communicator driver Driver ui packersdk.Ui vmName string
Produces:
<nothing>
func (*StepShutdown) Cleanup ¶
func (s *StepShutdown) Cleanup(state multistep.StateBag)
Cleanup does nothing.
func (*StepShutdown) Run ¶
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run shuts down the VM.
type StepTypeBootCommand ¶ added in v0.6.1
type StepTypeBootCommand struct { BootCommand string BootWait time.Duration HostInterfaces []string VMName string Ctx interpolate.Context GroupInterval time.Duration }
StepTypeBootCommand is a step that "types" the boot command into the VM via the prltype script, built on the Parallels Virtualization SDK - Python API.
func (*StepTypeBootCommand) Cleanup ¶ added in v0.6.1
func (*StepTypeBootCommand) Cleanup(multistep.StateBag)
Cleanup does nothing.
func (*StepTypeBootCommand) Run ¶ added in v0.6.1
func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run types the boot command by sending key scancodes into the VM.
type StepUploadParallelsTools ¶
type StepUploadParallelsTools struct { ParallelsToolsFlavor string ParallelsToolsGuestPath string ParallelsToolsMode string Ctx interpolate.Context }
StepUploadParallelsTools is a step that uploads the Parallels Tools ISO to the VM.
Uses:
communicator packersdk.Communicator parallels_tools_path string ui packersdk.Ui
func (*StepUploadParallelsTools) Cleanup ¶
func (s *StepUploadParallelsTools) Cleanup(state multistep.StateBag)
Cleanup does nothing.
func (*StepUploadParallelsTools) Run ¶
func (s *StepUploadParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run uploads the Parallels Tools ISO to the VM.
type StepUploadVersion ¶
type StepUploadVersion struct {
Path string
}
StepUploadVersion is a step that uploads a file containing the version of Parallels Desktop, which can be useful for various provisioning reasons.
Uses:
communicator packersdk.Communicator driver Driver ui packersdk.Ui
func (*StepUploadVersion) Cleanup ¶
func (s *StepUploadVersion) Cleanup(state multistep.StateBag)
Cleanup does nothing.
func (*StepUploadVersion) Run ¶
func (s *StepUploadVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Run uploads a file containing the version of Parallels Desktop.
type ToolsConfig ¶ added in v0.7.0
type ToolsConfig struct { // The flavor of the Parallels Tools ISO to // install into the VM. Valid values are "win", "lin", "mac", "os2" // and "other". This can be omitted only if parallels_tools_mode // is "disable". ParallelsToolsFlavor string `mapstructure:"parallels_tools_flavor" required:"true"` // The path in the virtual machine to // upload Parallels Tools. This only takes effect if parallels_tools_mode // is "upload". This is a configuration // template that has a single // valid variable: Flavor, which will be the value of // parallels_tools_flavor. By default this is `prl-tools-{{.Flavor}}.iso` // which should upload into the login directory of the user. ParallelsToolsGuestPath string `mapstructure:"parallels_tools_guest_path" required:"false"` // The method by which Parallels Tools are // made available to the guest for installation. Valid options are "upload", // "attach", or "disable". If the mode is "attach" the Parallels Tools ISO will // be attached as a CD device to the virtual machine. If the mode is "upload" // the Parallels Tools ISO will be uploaded to the path specified by // parallels_tools_guest_path. The default value is "upload". ParallelsToolsMode string `mapstructure:"parallels_tools_mode" required:"false"` }
ToolsConfig contains the builder configuration related to Parallels Tools.
func (*ToolsConfig) Prepare ¶ added in v0.7.0
func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error
Prepare validates & sets up configuration options related to Parallels Tools.
Source Files ¶
- artifact.go
- driver.go
- driver_10.go
- driver_11.go
- driver_9.go
- driver_mock.go
- host_ip.go
- host_ip_ifconfig.go
- hw_config.go
- output_config.go
- prlctl_config.go
- prlctl_post_config.go
- prlctl_version_config.go
- prltype.go
- ssh.go
- ssh_config.go
- step_attach_floppy.go
- step_attach_parallels_tools.go
- step_compact_disk.go
- step_output_dir.go
- step_prepare_parallels_tools.go
- step_prlctl.go
- step_run.go
- step_shutdown.go
- step_type_boot_command.go
- step_upload_parallels_tools.go
- step_upload_version.go
- tools_config.go