From aa623e22a3f2a1ceb30ff048705569737fdc5208 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Fri, 16 Dec 2016 21:51:55 +0200 Subject: [PATCH] golint: Add comments for exported methods --- builder/parallels/common/driver.go | 2 ++ builder/parallels/common/driver_10.go | 2 +- builder/parallels/common/driver_11.go | 2 ++ builder/parallels/common/driver_9.go | 17 ++++++++++++++++- builder/parallels/common/host_ip_ifconfig.go | 2 ++ builder/parallels/common/output_config.go | 2 ++ builder/parallels/common/prlctl_config.go | 3 +++ builder/parallels/common/prlctl_post_config.go | 3 +++ .../parallels/common/prlctl_version_config.go | 2 ++ builder/parallels/common/prltype.go | 2 ++ builder/parallels/common/run_config.go | 2 ++ builder/parallels/common/shutdown_config.go | 2 ++ builder/parallels/common/ssh.go | 2 ++ builder/parallels/common/ssh_config.go | 2 ++ builder/parallels/common/step_attach_floppy.go | 3 +++ .../common/step_attach_parallels_tools.go | 3 +++ builder/parallels/common/step_compact_disk.go | 2 ++ builder/parallels/common/step_output_dir.go | 2 ++ .../common/step_prepare_parallels_tools.go | 2 ++ builder/parallels/common/step_prlctl.go | 4 +++- builder/parallels/common/step_run.go | 2 ++ builder/parallels/common/step_shutdown.go | 2 ++ .../parallels/common/step_type_boot_command.go | 2 ++ .../common/step_upload_parallels_tools.go | 2 ++ builder/parallels/common/step_upload_version.go | 2 ++ builder/parallels/common/tools_config.go | 2 ++ 26 files changed, 70 insertions(+), 3 deletions(-) diff --git a/builder/parallels/common/driver.go b/builder/parallels/common/driver.go index c2a387d18..b485d5b67 100644 --- a/builder/parallels/common/driver.go +++ b/builder/parallels/common/driver.go @@ -61,6 +61,8 @@ type Driver interface { IPAddress(string) (string, error) } +// NewDriver returns a new driver implementation for this version of Parallels +// Desktop, or an error if the driver couldn't be initialized. func NewDriver() (Driver, error) { var drivers map[string]Driver var prlctlPath string diff --git a/builder/parallels/common/driver_10.go b/builder/parallels/common/driver_10.go index c37d421dc..be62251d5 100644 --- a/builder/parallels/common/driver_10.go +++ b/builder/parallels/common/driver_10.go @@ -1,11 +1,11 @@ package common // Parallels10Driver are inherited from Parallels9Driver. -// Used for Parallels v 10 & 11 type Parallels10Driver struct { Parallels9Driver } +// SetDefaultConfiguration applies pre-defined default settings to the VM config. func (d *Parallels10Driver) SetDefaultConfiguration(vmName string) error { commands := make([][]string, 12) commands[0] = []string{"set", vmName, "--cpus", "1"} diff --git a/builder/parallels/common/driver_11.go b/builder/parallels/common/driver_11.go index 7480f0cc6..09ebdeeb5 100644 --- a/builder/parallels/common/driver_11.go +++ b/builder/parallels/common/driver_11.go @@ -12,6 +12,7 @@ type Parallels11Driver struct { Parallels9Driver } +// Verify raises an error if the builder could not be used on that host machine. func (d *Parallels11Driver) Verify() error { stdout, err := exec.Command(d.PrlsrvctlPath, "info", "--license").Output() @@ -35,6 +36,7 @@ func (d *Parallels11Driver) Verify() error { return nil } +// SetDefaultConfiguration applies pre-defined default settings to the VM config. func (d *Parallels11Driver) SetDefaultConfiguration(vmName string) error { commands := make([][]string, 12) commands[0] = []string{"set", vmName, "--cpus", "1"} diff --git a/builder/parallels/common/driver_9.go b/builder/parallels/common/driver_9.go index edd6c16ab..e0e82fb68 100644 --- a/builder/parallels/common/driver_9.go +++ b/builder/parallels/common/driver_9.go @@ -16,6 +16,7 @@ import ( "gopkg.in/xmlpath.v2" ) +// Parallels9Driver is a base type for Parallels builders. type Parallels9Driver struct { // This is the path to the "prlctl" application. PrlctlPath string @@ -27,8 +28,8 @@ type Parallels9Driver struct { dhcpLeaseFile string } +// Import creates a clone of the source VM and reassigns the MAC address if needed. func (d *Parallels9Driver) Import(name, srcPath, dstDir string, reassignMAC bool) error { - err := d.Prlctl("register", srcPath, "--preserve-uuid") if err != nil { return err @@ -111,6 +112,7 @@ func getAppPath(bundleID string) (string, error) { return pathOutput, nil } +// CompactDisk performs the compation of the specified virtual disk image. func (d *Parallels9Driver) CompactDisk(diskPath string) error { prlDiskToolPath, err := exec.LookPath("prl_disk_tool") if err != nil { @@ -138,6 +140,7 @@ func (d *Parallels9Driver) CompactDisk(diskPath string) error { return nil } +// DeviceAddCDROM adds a virtual CDROM device and attaches the specified image. func (d *Parallels9Driver) DeviceAddCDROM(name string, image string) (string, error) { command := []string{ "set", name, @@ -161,6 +164,7 @@ func (d *Parallels9Driver) DeviceAddCDROM(name string, image string) (string, er return deviceName, nil } +// DiskPath returns a full path to the first virtual disk drive. func (d *Parallels9Driver) DiskPath(name string) (string, error) { out, err := exec.Command(d.PrlctlPath, "list", "-i", name).Output() if err != nil { @@ -178,6 +182,7 @@ func (d *Parallels9Driver) DiskPath(name string) (string, error) { return HDDPath, nil } +// IsRunning determines whether the VM is running or not. func (d *Parallels9Driver) IsRunning(name string) (bool, error) { var stdout bytes.Buffer @@ -208,6 +213,7 @@ func (d *Parallels9Driver) IsRunning(name string) (bool, error) { return false, nil } +// Stop forcibly stops the VM. func (d *Parallels9Driver) Stop(name string) error { if err := d.Prlctl("stop", name); err != nil { return err @@ -219,6 +225,7 @@ func (d *Parallels9Driver) Stop(name string) error { return nil } +// Prlctl executes the specified "prlctl" command. func (d *Parallels9Driver) Prlctl(args ...string) error { var stdout, stderr bytes.Buffer @@ -241,10 +248,12 @@ func (d *Parallels9Driver) Prlctl(args ...string) error { return err } +// Verify raises an error if the builder could not be used on that host machine. func (d *Parallels9Driver) Verify() error { return nil } +// Version returns the version of Parallels Desktop installed on that host. func (d *Parallels9Driver) Version() (string, error) { out, err := exec.Command(d.PrlctlPath, "--version").Output() if err != nil { @@ -263,6 +272,8 @@ func (d *Parallels9Driver) Version() (string, error) { return version, nil } +// SendKeyScanCodes sends the specified scancodes as key events to the VM. +// It is performed using "Prltype" script (refer to "prltype.go"). func (d *Parallels9Driver) SendKeyScanCodes(vmName string, codes ...string) error { var stdout, stderr bytes.Buffer @@ -312,6 +323,7 @@ func prepend(head string, tail []string) []string { return tmp } +// SetDefaultConfiguration applies pre-defined default settings to the VM config. func (d *Parallels9Driver) SetDefaultConfiguration(vmName string) error { commands := make([][]string, 7) commands[0] = []string{"set", vmName, "--cpus", "1"} @@ -331,6 +343,7 @@ func (d *Parallels9Driver) SetDefaultConfiguration(vmName string) error { return nil } +// MAC returns the MAC address of the VM's first network interface. func (d *Parallels9Driver) MAC(vmName string) (string, error) { var stdout bytes.Buffer @@ -394,6 +407,8 @@ func (d *Parallels9Driver) IPAddress(mac string) (string, error) { return mostRecentIP, nil } +// 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 (d *Parallels9Driver) ToolsISOPath(k string) (string, error) { appPath, err := getAppPath("com.parallels.desktop.console") if err != nil { diff --git a/builder/parallels/common/host_ip_ifconfig.go b/builder/parallels/common/host_ip_ifconfig.go index a197a45a5..36980032d 100644 --- a/builder/parallels/common/host_ip_ifconfig.go +++ b/builder/parallels/common/host_ip_ifconfig.go @@ -13,6 +13,8 @@ type IfconfigIPFinder struct { Devices []string } +// HostIP returns the host's IP address or an error if it could not be found +// from the `ifconfig` output. func (f *IfconfigIPFinder) HostIP() (string, error) { var ifconfigPath string diff --git a/builder/parallels/common/output_config.go b/builder/parallels/common/output_config.go index 2b7c7c94c..7514cf089 100644 --- a/builder/parallels/common/output_config.go +++ b/builder/parallels/common/output_config.go @@ -9,10 +9,12 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// OutputConfig contains the configuration for builder's output. type OutputConfig struct { OutputDir string `mapstructure:"output_directory"` } +// Prepare configures the output directory or returns an error if it already exists. func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error { if c.OutputDir == "" { c.OutputDir = fmt.Sprintf("output-%s", pc.PackerBuildName) diff --git a/builder/parallels/common/prlctl_config.go b/builder/parallels/common/prlctl_config.go index 4748bdeb7..f69ddf9ed 100644 --- a/builder/parallels/common/prlctl_config.go +++ b/builder/parallels/common/prlctl_config.go @@ -4,10 +4,13 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// PrlctlConfig contains the configuration for running "prlctl" commands +// before the VM start. type PrlctlConfig struct { Prlctl [][]string `mapstructure:"prlctl"` } +// Prepare sets the default value of "Prlctl" property. func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error { if c.Prlctl == nil { c.Prlctl = make([][]string, 0) diff --git a/builder/parallels/common/prlctl_post_config.go b/builder/parallels/common/prlctl_post_config.go index 2490bc996..5077bb1b3 100644 --- a/builder/parallels/common/prlctl_post_config.go +++ b/builder/parallels/common/prlctl_post_config.go @@ -4,10 +4,13 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// PrlctlPostConfig contains the configuration for running "prlctl" commands +// in the end of artifact build. type PrlctlPostConfig struct { PrlctlPost [][]string `mapstructure:"prlctl_post"` } +// Prepare sets the default value of "PrlctlPost" property. func (c *PrlctlPostConfig) Prepare(ctx *interpolate.Context) []error { if c.PrlctlPost == nil { c.PrlctlPost = make([][]string, 0) diff --git a/builder/parallels/common/prlctl_version_config.go b/builder/parallels/common/prlctl_version_config.go index 770001e0d..b47d46fc5 100644 --- a/builder/parallels/common/prlctl_version_config.go +++ b/builder/parallels/common/prlctl_version_config.go @@ -4,10 +4,12 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// PrlctlVersionConfig contains the configuration for `prlctl` version. type PrlctlVersionConfig struct { PrlctlVersionFile string `mapstructure:"prlctl_version_file"` } +// Prepare sets the default value of "PrlctlVersionFile" property. func (c *PrlctlVersionConfig) Prepare(ctx *interpolate.Context) []error { if c.PrlctlVersionFile == "" { c.PrlctlVersionFile = ".prlctl_version" diff --git a/builder/parallels/common/prltype.go b/builder/parallels/common/prltype.go index bd99e0a13..b0e11e1d0 100644 --- a/builder/parallels/common/prltype.go +++ b/builder/parallels/common/prltype.go @@ -1,5 +1,7 @@ package common +// Prltype is a Python scrypt allowin to send scancodes to the VM. It requires +// the module "prlsdkapi", which is bundled to Parallels Virtualization SDK. const Prltype string = ` import sys import prlsdkapi diff --git a/builder/parallels/common/run_config.go b/builder/parallels/common/run_config.go index 072895f41..a3c4aba55 100644 --- a/builder/parallels/common/run_config.go +++ b/builder/parallels/common/run_config.go @@ -7,12 +7,14 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// RunConfig contains the configuration for VM run. type RunConfig struct { RawBootWait string `mapstructure:"boot_wait"` BootWait time.Duration `` } +// Prepare sets the configuration for VM run. func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { if c.RawBootWait == "" { c.RawBootWait = "10s" diff --git a/builder/parallels/common/shutdown_config.go b/builder/parallels/common/shutdown_config.go index 83d2224c3..ee37ab938 100644 --- a/builder/parallels/common/shutdown_config.go +++ b/builder/parallels/common/shutdown_config.go @@ -7,6 +7,7 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// ShutdownConfig contains the configuration for VM shutdown. type ShutdownConfig struct { ShutdownCommand string `mapstructure:"shutdown_command"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` @@ -14,6 +15,7 @@ type ShutdownConfig struct { ShutdownTimeout time.Duration `` } +// Prepare sets default values to the VM shutdown configuration. func (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error { if c.RawShutdownTimeout == "" { c.RawShutdownTimeout = "5m" diff --git a/builder/parallels/common/ssh.go b/builder/parallels/common/ssh.go index 2c71c75a3..cdc5eab5c 100644 --- a/builder/parallels/common/ssh.go +++ b/builder/parallels/common/ssh.go @@ -7,6 +7,7 @@ import ( "golang.org/x/crypto/ssh" ) +// CommHost returns the VM's IP address which should be used to access it by SSH. func CommHost(state multistep.StateBag) (string, error) { vmName := state.Get("vmName").(string) driver := state.Get("driver").(Driver) @@ -24,6 +25,7 @@ func CommHost(state multistep.StateBag) (string, error) { return ip, nil } +// SSHConfigFunc returns SSH credentials to access the VM by SSH. func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*ssh.ClientConfig, error) { return func(state multistep.StateBag) (*ssh.ClientConfig, error) { auth := []ssh.AuthMethod{ diff --git a/builder/parallels/common/ssh_config.go b/builder/parallels/common/ssh_config.go index e7d9357ff..8612cc0c2 100644 --- a/builder/parallels/common/ssh_config.go +++ b/builder/parallels/common/ssh_config.go @@ -7,6 +7,7 @@ import ( "github.com/mitchellh/packer/template/interpolate" ) +// SSHConfig contains the configuration for SSH communicator. type SSHConfig struct { Comm communicator.Config `mapstructure:",squash"` @@ -15,6 +16,7 @@ type SSHConfig struct { SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"` } +// Prepare sets the default values for SSH communicator properties. func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error { // TODO: backwards compatibility, write fixer instead if c.SSHWaitTimeout != 0 { diff --git a/builder/parallels/common/step_attach_floppy.go b/builder/parallels/common/step_attach_floppy.go index dc0ff7ba6..64bf9ffa0 100644 --- a/builder/parallels/common/step_attach_floppy.go +++ b/builder/parallels/common/step_attach_floppy.go @@ -20,6 +20,8 @@ type StepAttachFloppy struct { floppyPath string } +// 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. func (s *StepAttachFloppy) Run(state multistep.StateBag) multistep.StepAction { // Determine if we even have a floppy disk to attach var floppyPath string @@ -62,6 +64,7 @@ func (s *StepAttachFloppy) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup removes the virtual FDD device attached to the VM. func (s *StepAttachFloppy) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) diff --git a/builder/parallels/common/step_attach_parallels_tools.go b/builder/parallels/common/step_attach_parallels_tools.go index 86e1a6a2a..1e809a8e0 100644 --- a/builder/parallels/common/step_attach_parallels_tools.go +++ b/builder/parallels/common/step_attach_parallels_tools.go @@ -23,6 +23,8 @@ type StepAttachParallelsTools struct { ParallelsToolsMode string } +// 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. func (s *StepAttachParallelsTools) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) @@ -55,6 +57,7 @@ func (s *StepAttachParallelsTools) Run(state multistep.StateBag) multistep.StepA return multistep.ActionContinue } +// Cleanup removes the virtual CD-ROM device attached to the VM. func (s *StepAttachParallelsTools) Cleanup(state multistep.StateBag) { if s.cdromDevice == "" { return diff --git a/builder/parallels/common/step_compact_disk.go b/builder/parallels/common/step_compact_disk.go index 68f4214ab..c6bd4e65e 100644 --- a/builder/parallels/common/step_compact_disk.go +++ b/builder/parallels/common/step_compact_disk.go @@ -21,6 +21,7 @@ type StepCompactDisk struct { Skip bool } +// Run runs the compaction of the virtual disk attached to the VM. func (s *StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) @@ -49,4 +50,5 @@ func (s *StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup does nothing. func (*StepCompactDisk) Cleanup(multistep.StateBag) {} diff --git a/builder/parallels/common/step_output_dir.go b/builder/parallels/common/step_output_dir.go index 0c7c04d15..0634dbdbb 100644 --- a/builder/parallels/common/step_output_dir.go +++ b/builder/parallels/common/step_output_dir.go @@ -20,6 +20,7 @@ type StepOutputDir struct { success bool } +// Run sets up the output directory. func (s *StepOutputDir) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) @@ -48,6 +49,7 @@ func (s *StepOutputDir) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup deletes the output directory. func (s *StepOutputDir) Cleanup(state multistep.StateBag) { _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) diff --git a/builder/parallels/common/step_prepare_parallels_tools.go b/builder/parallels/common/step_prepare_parallels_tools.go index 08f6fae3f..99e8722dc 100644 --- a/builder/parallels/common/step_prepare_parallels_tools.go +++ b/builder/parallels/common/step_prepare_parallels_tools.go @@ -20,6 +20,7 @@ type StepPrepareParallelsTools struct { ParallelsToolsMode string } +// Run sets the value of "parallels_tools_path". func (s *StepPrepareParallelsTools) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) @@ -46,4 +47,5 @@ func (s *StepPrepareParallelsTools) Run(state multistep.StateBag) multistep.Step return multistep.ActionContinue } +// Cleanup does nothing. func (s *StepPrepareParallelsTools) Cleanup(multistep.StateBag) {} diff --git a/builder/parallels/common/step_prlctl.go b/builder/parallels/common/step_prlctl.go index 8db445e27..7b29919f0 100644 --- a/builder/parallels/common/step_prlctl.go +++ b/builder/parallels/common/step_prlctl.go @@ -13,7 +13,7 @@ type commandTemplate struct { Name string } -// StepPrlctl is a step that executes additional prlctl commands as specified +// StepPrlctl is a step that executes additional `prlctl` commands as specified. // by the template. // // Uses: @@ -27,6 +27,7 @@ type StepPrlctl struct { Ctx interpolate.Context } +// Run executes `prlctl` commands. func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) @@ -67,4 +68,5 @@ func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup does nothing. func (s *StepPrlctl) Cleanup(state multistep.StateBag) {} diff --git a/builder/parallels/common/step_run.go b/builder/parallels/common/step_run.go index 53e413fb7..84b003de3 100644 --- a/builder/parallels/common/step_run.go +++ b/builder/parallels/common/step_run.go @@ -22,6 +22,7 @@ type StepRun struct { vmName string } +// Run starts the VM. func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) @@ -57,6 +58,7 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup stops the VM. func (s *StepRun) Cleanup(state multistep.StateBag) { if s.vmName == "" { return diff --git a/builder/parallels/common/step_shutdown.go b/builder/parallels/common/step_shutdown.go index d9933add6..e3ce2b1c2 100644 --- a/builder/parallels/common/step_shutdown.go +++ b/builder/parallels/common/step_shutdown.go @@ -26,6 +26,7 @@ type StepShutdown struct { Timeout time.Duration } +// Run shuts down the VM. func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) @@ -76,4 +77,5 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup does nothing. func (s *StepShutdown) Cleanup(state multistep.StateBag) {} diff --git a/builder/parallels/common/step_type_boot_command.go b/builder/parallels/common/step_type_boot_command.go index 7bb20356e..5d116f077 100644 --- a/builder/parallels/common/step_type_boot_command.go +++ b/builder/parallels/common/step_type_boot_command.go @@ -37,6 +37,7 @@ type StepTypeBootCommand struct { Ctx interpolate.Context } +// Run types the boot command by sending key scancodes into the VM. func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction { debug := state.Get("debug").(bool) httpPort := state.Get("http_port").(uint) @@ -144,6 +145,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction return multistep.ActionContinue } +// Cleanup does nothing. func (*StepTypeBootCommand) Cleanup(multistep.StateBag) {} func scancodes(message string) []string { diff --git a/builder/parallels/common/step_upload_parallels_tools.go b/builder/parallels/common/step_upload_parallels_tools.go index ed9844b7a..9df78bd38 100644 --- a/builder/parallels/common/step_upload_parallels_tools.go +++ b/builder/parallels/common/step_upload_parallels_tools.go @@ -36,6 +36,7 @@ type StepUploadParallelsTools struct { Ctx interpolate.Context } +// Run uploads the Parallels Tools ISO to the VM. func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) ui := state.Get("ui").(packer.Ui) @@ -80,4 +81,5 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA return multistep.ActionContinue } +// Cleanup does nothing. func (s *StepUploadParallelsTools) Cleanup(state multistep.StateBag) {} diff --git a/builder/parallels/common/step_upload_version.go b/builder/parallels/common/step_upload_version.go index 47a158ddc..a120f1478 100644 --- a/builder/parallels/common/step_upload_version.go +++ b/builder/parallels/common/step_upload_version.go @@ -20,6 +20,7 @@ type StepUploadVersion struct { Path string } +// Run uploads a file containing the version of Parallels Desktop. func (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) @@ -47,4 +48,5 @@ func (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } +// Cleanup does nothing. func (s *StepUploadVersion) Cleanup(state multistep.StateBag) {} diff --git a/builder/parallels/common/tools_config.go b/builder/parallels/common/tools_config.go index 344e1e88c..c587a77ad 100644 --- a/builder/parallels/common/tools_config.go +++ b/builder/parallels/common/tools_config.go @@ -15,12 +15,14 @@ const ( ParallelsToolsModeUpload = "upload" ) +// ToolsConfig contains the builder configuration related to Parallels Tools. type ToolsConfig struct { ParallelsToolsFlavor string `mapstructure:"parallels_tools_flavor"` ParallelsToolsGuestPath string `mapstructure:"parallels_tools_guest_path"` ParallelsToolsMode string `mapstructure:"parallels_tools_mode"` } +// Prepare validates & sets up configuration options related to Parallels Tools. func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error { if c.ParallelsToolsMode == "" { c.ParallelsToolsMode = ParallelsToolsModeUpload