common

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2016 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const BuilderId = "packer.parallels"

This is the common builder ID to all of these artifacts.

View Source
const KeyLeftShift uint32 = 0xFFE1
View Source
const Prltype string = `` /* 1593-byte string literal not displayed */

Variables

This section is empty.

Functions

func CommHost added in v0.8.0

func CommHost(state multistep.StateBag) (string, error)

func NewArtifact

func NewArtifact(dir string) (packer.Artifact, error)

NewArtifact returns a Parallels artifact containing the files in the given directory.

func SSHConfigFunc

func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*ssh.ClientConfig, error)

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 сonfiguration 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)
}

A driver is able to talk to Parallels 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 Parallels builder for Packer, and to abstract differences in versions out of the builder steps, so sometimes the methods are extremely specific.

func NewDriver

func NewDriver() (Driver, error)

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.7.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) Import

func (d *DriverMock) Import(name, srcPath, dstPath string, reassignMac bool) error

func (*DriverMock) IpAddress

func (d *DriverMock) IpAddress(mac string) (string, error)

func (*DriverMock) IsRunning

func (d *DriverMock) IsRunning(name string) (bool, error)

func (*DriverMock) Mac

func (d *DriverMock) Mac(name string) (string, 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.7.0

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 FloppyConfig

type FloppyConfig struct {
	FloppyFiles []string `mapstructure:"floppy_files"`
}

FloppyConfig is configuration related to created floppy disks and attaching them to a Parallels virtual machine.

func (*FloppyConfig) Prepare

func (c *FloppyConfig) Prepare(ctx *interpolate.Context) []error

type HostIPFinder added in v0.6.1

type HostIPFinder interface {
	HostIP() (string, error)
}

Interface to help 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)

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 Parallels10Driver added in v0.7.0

type Parallels10Driver struct {
	Parallels9Driver
}

Parallels10Driver are inherited from Parallels9Driver. Used for Parallels v 10 & 11

func (*Parallels10Driver) SetDefaultConfiguration added in v0.8.0

func (d *Parallels10Driver) SetDefaultConfiguration(vmName string) error

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

func (*Parallels11Driver) Verify added in v0.9.0

func (d *Parallels11Driver) Verify() error

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
}

func (*Parallels9Driver) CompactDisk added in v0.9.0

func (d *Parallels9Driver) CompactDisk(diskPath string) error

func (*Parallels9Driver) DeviceAddCdRom added in v0.7.2

func (d *Parallels9Driver) DeviceAddCdRom(name string, image string) (string, error)

func (*Parallels9Driver) DiskPath added in v0.9.0

func (d *Parallels9Driver) DiskPath(name string) (string, error)

func (*Parallels9Driver) Import

func (d *Parallels9Driver) Import(name, srcPath, dstDir string, reassignMac bool) error

func (*Parallels9Driver) IpAddress

func (d *Parallels9Driver) IpAddress(mac string) (string, error)

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) IsRunning

func (d *Parallels9Driver) IsRunning(name string) (bool, error)

func (*Parallels9Driver) Mac

func (d *Parallels9Driver) Mac(vmName string) (string, error)

func (*Parallels9Driver) Prlctl

func (d *Parallels9Driver) Prlctl(args ...string) error

func (*Parallels9Driver) SendKeyScanCodes

func (d *Parallels9Driver) SendKeyScanCodes(vmName string, codes ...string) error

func (*Parallels9Driver) SetDefaultConfiguration added in v0.8.0

func (d *Parallels9Driver) SetDefaultConfiguration(vmName string) error

func (*Parallels9Driver) Stop

func (d *Parallels9Driver) Stop(name string) error

func (*Parallels9Driver) ToolsIsoPath added in v0.7.0

func (d *Parallels9Driver) ToolsIsoPath(k string) (string, error)

func (*Parallels9Driver) Verify

func (d *Parallels9Driver) Verify() error

func (*Parallels9Driver) Version

func (d *Parallels9Driver) Version() (string, error)

type PrlctlConfig

type PrlctlConfig struct {
	Prlctl [][]string `mapstructure:"prlctl"`
}

func (*PrlctlConfig) Prepare

func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error

type PrlctlPostConfig added in v0.8.0

type PrlctlPostConfig struct {
	PrlctlPost [][]string `mapstructure:"prlctl_post"`
}

func (*PrlctlPostConfig) Prepare added in v0.8.0

func (c *PrlctlPostConfig) Prepare(ctx *interpolate.Context) []error

type PrlctlVersionConfig

type PrlctlVersionConfig struct {
	PrlctlVersionFile string `mapstructure:"prlctl_version_file"`
}

func (*PrlctlVersionConfig) Prepare

func (c *PrlctlVersionConfig) Prepare(ctx *interpolate.Context) []error

type RunConfig

type RunConfig struct {
	RawBootWait string `mapstructure:"boot_wait"`

	BootWait time.Duration ``
}

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(ctx *interpolate.Context) []error

type SSHConfig

type SSHConfig struct {
	Comm communicator.Config `mapstructure:",squash"`

	// These are deprecated, but we keep them around for BC
	// TODO(@mitchellh): remove
	SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"`
}

func (*SSHConfig) Prepare

func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error

type ShutdownConfig

type ShutdownConfig struct {
	ShutdownCommand    string `mapstructure:"shutdown_command"`
	RawShutdownTimeout string `mapstructure:"shutdown_timeout"`

	ShutdownTimeout 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 a floppy 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

type StepAttachParallelsTools

type StepAttachParallelsTools struct {
	ParallelsToolsMode string
	// contains filtered or unexported fields
}

This step attaches the Parallels Tools as an inserted CD onto the virtual machine.

Uses:

driver Driver
parallels_tools_path string
ui packer.Ui
vmName string

Produces:

func (*StepAttachParallelsTools) Cleanup

func (s *StepAttachParallelsTools) Cleanup(state multistep.StateBag)

func (*StepAttachParallelsTools) Run

type StepCompactDisk added in v0.9.0

type StepCompactDisk struct {
	Skip bool
}

This step removes all empty blocks from expanding Parallels virtual disks and reduces the result disk size

Uses:

driver Driver
vmName string
ui     packer.Ui

Produces:

<nothing>

func (*StepCompactDisk) Cleanup added in v0.9.0

func (*StepCompactDisk) Run added in v0.9.0

type StepOutputDir

type StepOutputDir struct {
	Force bool
	Path  string
	// contains filtered or unexported fields
}

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

type StepPrepareParallelsTools added in v0.7.0

type StepPrepareParallelsTools struct {
	ParallelsToolsFlavor string
	ParallelsToolsMode   string
}

This step prepares parameters related to Parallels Tools.

Uses:

driver Driver

Produces:

parallels_tools_path string

func (*StepPrepareParallelsTools) Cleanup added in v0.7.0

func (*StepPrepareParallelsTools) Run added in v0.7.0

type StepPrlctl

type StepPrlctl struct {
	Commands [][]string
	Ctx      interpolate.Context
}

This step executes additional prlctl commands as specified by the template.

Uses:

driver Driver
ui packer.Ui
vmName string

Produces:

func (*StepPrlctl) Cleanup

func (s *StepPrlctl) Cleanup(state multistep.StateBag)

func (*StepPrlctl) Run

type StepRun

type StepRun struct {
	BootWait time.Duration
	// contains filtered or unexported fields
}

This step starts the virtual machine.

Uses:

driver Driver
ui packer.Ui
vmName string

Produces:

func (*StepRun) Cleanup

func (s *StepRun) Cleanup(state multistep.StateBag)

func (*StepRun) Run

type StepShutdown

type StepShutdown struct {
	Command string
	Timeout time.Duration
}

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

type StepTypeBootCommand added in v0.6.1

type StepTypeBootCommand struct {
	BootCommand    []string
	HostInterfaces []string
	VMName         string
	Ctx            interpolate.Context
}

This step "types" the boot command into the VM via the prltype script, built on the Parallels Virtualization SDK - Python API.

Uses:

driver Driver
http_port int
ui     packer.Ui
vmName string

Produces:

<nothing>

func (*StepTypeBootCommand) Cleanup added in v0.6.1

func (*StepTypeBootCommand) Run added in v0.6.1

type StepUploadParallelsTools

type StepUploadParallelsTools struct {
	ParallelsToolsFlavor    string
	ParallelsToolsGuestPath string
	ParallelsToolsMode      string
	Ctx                     interpolate.Context
}

This step uploads the guest additions ISO to the VM.

func (*StepUploadParallelsTools) Cleanup

func (s *StepUploadParallelsTools) Cleanup(state multistep.StateBag)

func (*StepUploadParallelsTools) Run

type StepUploadVersion

type StepUploadVersion struct {
	Path string
}

This step uploads a file containing the Parallels version, which can be useful for various provisioning reasons.

func (*StepUploadVersion) Cleanup

func (s *StepUploadVersion) Cleanup(state multistep.StateBag)

func (*StepUploadVersion) Run

type ToolsConfig added in v0.7.0

type ToolsConfig struct {
	ParallelsToolsFlavor    string `mapstructure:"parallels_tools_flavor"`
	ParallelsToolsGuestPath string `mapstructure:"parallels_tools_guest_path"`
	ParallelsToolsMode      string `mapstructure:"parallels_tools_mode"`
}

func (*ToolsConfig) Prepare added in v0.7.0

func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL