common

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2014 License: MPL-2.0 Imports: 18 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.

Variables

This section is empty.

Functions

func NewArtifact

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

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

func SSHAddress

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

func SSHConfigFunc

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

Types

type Driver

type Driver interface {
	// Import a VM
	Import(string, string, 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

	// Prlctl executes the given Prlctl command
	Prlctl(...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 tool.
	SendKeyScanCodes(string, ...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

	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

	MacName   string
	MacReturn string
	MacError  error

	IpAddressMac    string
	IpAddressReturn string
	IpAddressError  error
}

func (*DriverMock) Import

func (d *DriverMock) Import(name, srcPath, dstPath string) 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) Stop

func (d *DriverMock) Stop(name 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(t *packer.ConfigTemplate) []error

type OutputConfig

type OutputConfig struct {
	OutputDir string `mapstructure:"output_directory"`
}

func (*OutputConfig) Prepare

type Parallels9Driver

type Parallels9Driver struct {
	// This is the path to the "prlctl" application.
	PrlctlPath string
}

func (*Parallels9Driver) Import

func (d *Parallels9Driver) Import(name, srcPath, dstDir string) 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

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

func (d *Parallels9Driver) Stop(name 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(t *packer.ConfigTemplate) []error

type PrlctlVersionConfig

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

func (*PrlctlVersionConfig) Prepare

type RunConfig

type RunConfig struct {
	Headless    bool   `mapstructure:"headless"`
	RawBootWait string `mapstructure:"boot_wait"`

	BootWait time.Duration ``
}

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error

type SSHConfig

type SSHConfig struct {
	SSHKeyPath        string `mapstructure:"ssh_key_path"`
	SSHPassword       string `mapstructure:"ssh_password"`
	SSHPort           uint   `mapstructure:"ssh_port"`
	SSHUser           string `mapstructure:"ssh_username"`
	RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"`

	SSHWaitTimeout time.Duration
}

func (*SSHConfig) Prepare

func (c *SSHConfig) Prepare(t *packer.ConfigTemplate) []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(t *packer.ConfigTemplate) []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 {
	ParallelsToolsHostPath string
	ParallelsToolsMode     string
}

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

Uses:

driver Driver
toolsPath string
ui packer.Ui
vmName string

Produces:

func (*StepAttachParallelsTools) Cleanup

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

func (*StepAttachParallelsTools) Run

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 StepPrlctl

type StepPrlctl struct {
	Commands [][]string
	Tpl      *packer.ConfigTemplate
}

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

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:

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 StepUploadParallelsTools

type StepUploadParallelsTools struct {
	ParallelsToolsHostPath  string
	ParallelsToolsGuestPath string
	ParallelsToolsMode      string
	Tpl                     *packer.ConfigTemplate
}

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

Jump to

Keyboard shortcuts

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