common

package
v0.0.0-...-2819adb Latest Latest
Warning

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

Go to latest
Published: May 3, 2014 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "yungsang.parallels"

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

Variables

View Source
var UnnecessaryFileExtensions = []string{".log", ".backup", ".Backup"}

These are the extensions of files that are unnecessary for the function of a Parallels virtual machine.

Functions

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) (*gossh.ClientConfig, error)

Types

type DHCPLeaseGuestLookup

type DHCPLeaseGuestLookup struct {
	// Driver that is being used (to find leases path)
	Driver Driver

	// MAC address of the guest.
	MACAddress string
}

DHCPLeaseGuestLookup looks up the IP address of a guest using DHCP lease information from the VMware network devices.

func (*DHCPLeaseGuestLookup) GuestIP

func (f *DHCPLeaseGuestLookup) GuestIP() (string, error)

type Driver

type Driver interface {

	// Delete a VM by name
	Delete(string) error

	// Import a VM
	Import(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

	// Use default settings from Parallels
	UseDefaults(string) error

	// PrlCtl executes the given prlctl command
	PrlCtl(...string) error

	// SSHAddress returns the SSH address for the VM that is being
	// managed by this driver.
	SSHAddressFunc(*SSHConfig) func(multistep.StateBag) (string, error)

	// Get the path to the DHCP leases file for the given device.
	DhcpLeasesPath() string

	// 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)
}

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

	CreateSATAControllerVM         string
	CreateSATAControllerController string
	CreateSATAControllerErr        error

	DeleteCalled bool
	DeleteName   string
	DeleteErr    error

	ImportCalled bool
	ImportName   string
	ImportPath   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
}

func (*DriverMock) CreateSATAController

func (d *DriverMock) CreateSATAController(vm string, controller string) error

func (*DriverMock) Delete

func (d *DriverMock) Delete(name string) error

func (*DriverMock) Import

func (d *DriverMock) Import(name, path string) error

func (*DriverMock) IsRunning

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

func (*DriverMock) PrlCtl

func (d *DriverMock) PrlCtl(args ...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 GuestIPFinder

type GuestIPFinder interface {
	GuestIP() (string, error)
}

Interface to help find the IP address of a running virtual machine.

type OutputConfig

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

func (*OutputConfig) Prepare

type Parallels8Driver

type Parallels8Driver struct {
	// This is the path to the "prlctl" application.
	PrlCtlPath string
}

func (*Parallels8Driver) Delete

func (d *Parallels8Driver) Delete(name string) error

func (*Parallels8Driver) DhcpLeasesPath

func (d *Parallels8Driver) DhcpLeasesPath() string

func (*Parallels8Driver) Import

func (d *Parallels8Driver) Import(srcName, dstName string) error

func (*Parallels8Driver) IsRunning

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

func (*Parallels8Driver) PrlCtl

func (d *Parallels8Driver) PrlCtl(args ...string) error

func (*Parallels8Driver) SSHAddressFunc

func (d *Parallels8Driver) SSHAddressFunc(config *SSHConfig) func(multistep.StateBag) (string, error)

func (*Parallels8Driver) Stop

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

func (*Parallels8Driver) UseDefaults

func (d *Parallels8Driver) UseDefaults(name string) error

func (*Parallels8Driver) Verify

func (d *Parallels8Driver) Verify() error

func (*Parallels8Driver) Version

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

type PrlCtlConfig

type PrlCtlConfig struct {
	PrlCtl [][]string `mapstructure:"prlctl"`
}

func (*PrlCtlConfig) Prepare

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

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 StepCleanFiles

type StepCleanFiles struct {
	OutputDir string
}

This step removes unnecessary files from the final result.

Uses:

dir    OutputDir
ui     packer.Ui

Produces:

<nothing>

func (StepCleanFiles) Cleanup

func (*StepCleanFiles) ListFiles

func (s *StepCleanFiles) ListFiles() ([]string, error)

func (*StepCleanFiles) Run

type StepOutputDir

type StepOutputDir struct {
	Force bool
	Path  string
}

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

Jump to

Keyboard shortcuts

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