Documentation
¶
Index ¶
- Constants
- Variables
- func NewArtifact(dir string) (packer.Artifact, error)
- func SSHConfigFunc(config *SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)
- type DHCPLeaseGuestLookup
- type Driver
- type DriverMock
- func (d *DriverMock) CreateSATAController(vm string, controller string) error
- func (d *DriverMock) Delete(name string) error
- func (d *DriverMock) Import(name, path string) error
- func (d *DriverMock) IsRunning(name string) (bool, error)
- func (d *DriverMock) PrlCtl(args ...string) error
- func (d *DriverMock) Stop(name string) error
- func (d *DriverMock) Verify() error
- func (d *DriverMock) Version() (string, error)
- type GuestIPFinder
- type OutputConfig
- type Parallels8Driver
- func (d *Parallels8Driver) Delete(name string) error
- func (d *Parallels8Driver) DhcpLeasesPath() string
- func (d *Parallels8Driver) Import(srcName, dstName string) error
- func (d *Parallels8Driver) IsRunning(name string) (bool, error)
- func (d *Parallels8Driver) PrlCtl(args ...string) error
- func (d *Parallels8Driver) SSHAddressFunc(config *SSHConfig) func(multistep.StateBag) (string, error)
- func (d *Parallels8Driver) Stop(name string) error
- func (d *Parallels8Driver) UseDefaults(name string) error
- func (d *Parallels8Driver) Verify() error
- func (d *Parallels8Driver) Version() (string, error)
- type PrlCtlConfig
- type RunConfig
- type SSHConfig
- type ShutdownConfig
- type StepCleanFiles
- type StepOutputDir
- type StepPrlCtl
- type StepRemoveDevices
- type StepRun
- type StepShutdown
Constants ¶
const BuilderId = "yungsang.parallels"
This is the common builder ID to all of these artifacts.
Variables ¶
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 ¶
NewArtifact returns a Parallels artifact containing the files in the given directory.
func SSHConfigFunc ¶
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.
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) 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 ¶
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 ¶
func (c *OutputConfig) Prepare(t *packer.ConfigTemplate, pc *common.PackerConfig) []error
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 (*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 SSHConfig ¶
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) Cleanup(multistep.StateBag)
func (*StepCleanFiles) ListFiles ¶
func (s *StepCleanFiles) ListFiles() ([]string, error)
func (*StepCleanFiles) Run ¶
func (s *StepCleanFiles) Run(state multistep.StateBag) multistep.StepAction
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)
func (*StepOutputDir) Run ¶
func (s *StepOutputDir) Run(state multistep.StateBag) multistep.StepAction
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 ¶
func (s *StepPrlCtl) Run(state multistep.StateBag) multistep.StepAction
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 ¶
func (s *StepRemoveDevices) Run(state multistep.StateBag) multistep.StepAction
type StepRun ¶
This step starts the virtual machine.
Uses:
driver Driver ui packer.Ui vmName string
Produces:
type StepShutdown ¶
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 ¶
func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction