common

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GuestAdditionsModeDisable string = "disable"
	GuestAdditionsModeAttach         = "attach"
	GuestAdditionsModeUpload         = "upload"
)

These are the different valid mode values for "guest_additions_mode" which determine how guest additions are delivered to the guest.

View Source
const BuilderId = "mitchellh.virtualbox"

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

View Source
const KeyLeftShift uint32 = 0xFFE1

Variables

This section is empty.

Functions

func CommHost added in v0.8.0

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

func NewArtifact

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

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

func SSHPort added in v0.8.0

func SSHPort(state multistep.StateBag) (int, error)

Types

type Driver

type Driver interface {
	// Create a SATA controller.
	CreateSATAController(vm string, controller string, portcount int) error

	// Create a SCSI controller.
	CreateSCSIController(vm string, controller string) error

	// Create an NVME controller
	CreateNVMeController(vm string, controller string, portcount int) error

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

	// Import a VM
	Import(string, string, []string) error

	// The complete path to the Guest Additions ISO
	Iso() (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

	// SuppressMessages should do what needs to be done in order to
	// suppress any annoying popups from VirtualBox.
	SuppressMessages() error

	// VBoxManage executes the given VBoxManage command
	// and returns the stdout channel as string
	VBoxManage(...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 VirtualBox that is installed.
	Version() (string, error)

	// LoadSnapshots Loads all defined snapshots for a vm.
	// if no snapshots are defined nil will be returned
	LoadSnapshots(string) (*VBoxSnapshot, error)

	// CreateSnapshot Creates a snapshot for a vm with a given name
	CreateSnapshot(string, string) error

	// HasSnapshots tests if a vm has snapshots
	HasSnapshots(string) (bool, error)

	// GetCurrentSnapshot Returns the current snapshot for a vm
	GetCurrentSnapshot(string) (*VBoxSnapshot, error)

	// SetSnapshot sets the for a vm
	SetSnapshot(string, *VBoxSnapshot) error

	// DeleteSnapshot deletes the specified snapshot from a vm
	DeleteSnapshot(string, *VBoxSnapshot) error
}

A driver is able to talk to VirtualBox 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 VirtualBox 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

	CreateSCSIControllerVM         string
	CreateSCSIControllerController string
	CreateSCSIControllerErr        error

	CreateNVMeControllerVM         string
	CreateNVMeControllerController string
	CreateNVMeControllerErr        error

	DeleteCalled bool
	DeleteName   string
	DeleteErr    error

	ImportCalled bool
	ImportName   string
	ImportPath   string
	ImportFlags  []string
	ImportErr    error

	IsoCalled bool
	IsoErr    error

	IsRunningName   string
	IsRunningReturn bool
	IsRunningErr    error

	StopName string
	StopErr  error

	SuppressMessagesCalled bool
	SuppressMessagesErr    error

	VBoxManageCalls [][]string
	VBoxManageErrs  []error

	VerifyCalled bool
	VerifyErr    error

	VersionCalled bool
	VersionResult string
	VersionErr    error

	LoadSnapshotsCalled      []string
	LoadSnapshotsResult      *VBoxSnapshot
	CreateSnapshotCalled     []string
	CreateSnapshotError      error
	HasSnapshotsCalled       []string
	HasSnapshotsResult       bool
	GetCurrentSnapshotCalled []string
	GetCurrentSnapshotResult *VBoxSnapshot
	SetSnapshotCalled        []*VBoxSnapshot
	DeleteSnapshotCalled     []*VBoxSnapshot
}

func (*DriverMock) CreateNVMeController added in v1.4.5

func (d *DriverMock) CreateNVMeController(vm string, controller string, portcount int) error

func (*DriverMock) CreateSATAController

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

func (*DriverMock) CreateSCSIController added in v0.8.0

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

func (*DriverMock) CreateSnapshot added in v1.4.3

func (d *DriverMock) CreateSnapshot(vmName string, snapshotName string) error

func (*DriverMock) Delete

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

func (*DriverMock) DeleteSnapshot added in v1.4.3

func (d *DriverMock) DeleteSnapshot(vmName string, snapshot *VBoxSnapshot) error

func (*DriverMock) GetCurrentSnapshot added in v1.4.3

func (d *DriverMock) GetCurrentSnapshot(vmName string) (*VBoxSnapshot, error)

func (*DriverMock) HasSnapshots added in v1.4.3

func (d *DriverMock) HasSnapshots(vmName string) (bool, error)

func (*DriverMock) Import

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

func (*DriverMock) IsRunning

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

func (*DriverMock) Iso added in v0.6.1

func (d *DriverMock) Iso() (string, error)

func (*DriverMock) LoadSnapshots added in v1.4.3

func (d *DriverMock) LoadSnapshots(vmName string) (*VBoxSnapshot, error)

func (*DriverMock) SetSnapshot added in v1.4.3

func (d *DriverMock) SetSnapshot(vmName string, snapshot *VBoxSnapshot) error

func (*DriverMock) Stop

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

func (*DriverMock) SuppressMessages

func (d *DriverMock) SuppressMessages() error

func (*DriverMock) VBoxManage

func (d *DriverMock) VBoxManage(args ...string) error

func (*DriverMock) Verify

func (d *DriverMock) Verify() error

func (*DriverMock) Version

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

type ExportConfig

type ExportConfig struct {
	// Either ovf or ova, this specifies the output format
	// of the exported virtual machine. This defaults to ovf.
	Format string `mapstructure:"format" required:"false"`
	// Additional options to pass to the [VBoxManage
	// export](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export).
	// This can be useful for passing product information to include in the
	// resulting appliance file. Packer JSON configuration file example:
	//
	// “` json
	// {
	//   "type": "virtualbox-iso",
	//   "export_opts":
	//   [
	//     "--manifest",
	//     "--vsys", "0",
	//     "--description", "{{user `vm_description`}}",
	//     "--version", "{{user `vm_version`}}"
	//   ],
	//   "format": "ova",
	// }
	// “`
	//
	// A VirtualBox [VM
	// description](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export-ovf)
	// may contain arbitrary strings; the GUI interprets HTML formatting. However,
	// the JSON format does not allow arbitrary newlines within a value. Add a
	// multi-line description by preparing the string in the shell before the
	// packer call like this (shell `>` continuation character snipped for easier
	// copy & paste):
	//
	// “` {.shell}
	//
	// vm_description='some
	// multiline
	// description'
	//
	// vm_version='0.2.0'
	//
	// packer build \
	//     -var "vm_description=${vm_description}" \
	//     -var "vm_version=${vm_version}"         \
	//     "packer_conf.json"
	// “`
	ExportOpts []string `mapstructure:"export_opts" required:"false"`
}

func (*ExportConfig) Prepare

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

type GuestAdditionsConfig added in v1.4.0

type GuestAdditionsConfig struct {
	Communicator string `mapstructure:"communicator"`
	// The method by which guest additions are
	// made available to the guest for installation. Valid options are upload,
	// attach, or disable. If the mode is attach the guest additions ISO will
	// be attached as a CD device to the virtual machine. If the mode is upload
	// the guest additions ISO will be uploaded to the path specified by
	// guest_additions_path. The default value is upload. If disable is used,
	// guest additions won't be downloaded, either.
	GuestAdditionsMode string `mapstructure:"guest_additions_mode" required:"false"`
}

func (*GuestAdditionsConfig) Prepare added in v1.4.0

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

type HWConfig added in v1.3.3

type HWConfig struct {
	// The number of cpus to use for building the VM.
	// Defaults to 1.
	CpuCount int `mapstructure:"cpus" required:"false"`
	// The amount of memory to use for building the VM
	// in megabytes. Defaults to 512 megabytes.
	MemorySize int `mapstructure:"memory" required:"false"`
	// Defaults to none. The type of audio device to use for
	// sound when building the VM. Some of the options that are available are
	// dsound, oss, alsa, pulse, coreaudio, null.
	Sound string `mapstructure:"sound" required:"false"`
	// Specifies whether or not to enable the USB bus when
	// building the VM. Defaults to false.
	USB bool `mapstructure:"usb" required:"false"`
}

func (*HWConfig) Prepare added in v1.3.3

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

type OutputConfig

type OutputConfig struct {
	// This is the path to the directory where the
	// resulting virtual machine will be created. This may be relative or absolute.
	// If relative, the path is relative to the working directory when packer
	// is executed. This directory must not exist or be empty prior to running
	// the builder. By default this is output-BUILDNAME where "BUILDNAME" is the
	// name of the build.
	OutputDir string `mapstructure:"output_directory" required:"false"`
}

func (*OutputConfig) Prepare

func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error

type RunConfig

type RunConfig struct {
	// Packer defaults to building VirtualBox virtual
	// machines by launching a GUI that shows the console of the machine
	// being built. When this value is set to true, the machine will start
	// without a console.
	Headless bool `mapstructure:"headless" required:"false"`
	// The IP address that should be
	// binded to for VRDP. By default packer will use 127.0.0.1 for this. If you
	// wish to bind to all interfaces use 0.0.0.0.
	VRDPBindAddress string `mapstructure:"vrdp_bind_address" required:"false"`
	// The minimum and maximum port
	// to use for VRDP access to the virtual machine. Packer uses a randomly chosen
	// port in this range that appears available. By default this is 5900 to
	// 6000. The minimum and maximum ports are inclusive.
	VRDPPortMin int `mapstructure:"vrdp_port_min" required:"false"`
	VRDPPortMax int `mapstructure:"vrdp_port_max"`
}

func (*RunConfig) Prepare

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

type SSHConfig

type SSHConfig struct {
	Comm communicator.Config `mapstructure:",squash"`
	// The minimum and
	// maximum port to use for the SSH port on the host machine which is forwarded
	// to the SSH port on the guest machine. Because Packer often runs in parallel,
	// Packer will choose a randomly available port in this range to use as the
	// host port. By default this is 2222 to 4444.
	SSHHostPortMin int `mapstructure:"ssh_host_port_min" required:"false"`
	SSHHostPortMax int `mapstructure:"ssh_host_port_max"`
	// Defaults to false. When enabled, Packer
	// does not setup forwarded port mapping for SSH requests and uses ssh_port
	// on the host to communicate to the virtual machine.
	SSHSkipNatMapping bool `mapstructure:"ssh_skip_nat_mapping" required:"false"`

	// 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 {
	// The command to use to gracefully shut down the
	// machine once all the provisioning is done. By default this is an empty
	// string, which tells Packer to just forcefully shut down the machine unless a
	// shutdown command takes place inside script so this may safely be omitted. If
	// one or more scripts require a reboot it is suggested to leave this blank
	// since reboots may fail and specify the final shutdown command in your
	// last script.
	ShutdownCommand string `mapstructure:"shutdown_command" required:"false"`
	// The amount of time to wait after executing the
	// shutdown_command for the virtual machine to actually shut down. If it
	// doesn't shut down in this time, it is an error. By default, the timeout is
	// 5m or five minutes.
	ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" required:"false"`
	// The amount of time to wait after shutting
	// down the virtual machine. If you get the error
	// Error removing floppy controller, you might need to set this to 5m
	// or so. By default, the delay is 0s or disabled.
	PostShutdownDelay time.Duration `mapstructure:"post_shutdown_delay" required:"false"`
	// Packer normally halts the virtual machine after all provisioners have
	// run when no `shutdown_command` is defined.  If this is set to `true`, Packer
	// *will not* halt the virtual machine but will assume that you will send the stop
	// signal yourself through the preseed.cfg or your final provisioner.
	// Packer will wait for a default of 5 minutes until the virtual machine is shutdown.
	// The timeout can be changed using `shutdown_timeout` option.
	DisableShutdown bool `mapstructure:"disable_shutdown" required:"false"`
}

func (*ShutdownConfig) Prepare

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

type StepAttachFloppy

type StepAttachFloppy struct {
	// contains filtered or unexported fields
}

This step attaches the ISO 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 StepAttachGuestAdditions added in v0.6.1

type StepAttachGuestAdditions struct {
	GuestAdditionsMode      string
	GuestAdditionsInterface string
	// contains filtered or unexported fields
}

This step attaches the VirtualBox guest additions as a inserted CD onto the virtual machine.

Uses:

config *config
driver Driver
guest_additions_path string
ui packer.Ui
vmName string

Produces:

func (*StepAttachGuestAdditions) Cleanup added in v0.6.1

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

func (*StepAttachGuestAdditions) Run added in v0.6.1

type StepConfigureVRDP added in v0.9.0

type StepConfigureVRDP struct {
	VRDPBindAddress string
	VRDPPortMin     int
	VRDPPortMax     int
	// contains filtered or unexported fields
}

This step configures the VM to enable the VRDP server on the guest machine.

Uses:

driver Driver
ui packer.Ui
vmName string

Produces: vrdp_port unit - The port that VRDP is configured to listen on.

func (*StepConfigureVRDP) Cleanup added in v0.9.0

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

func (*StepConfigureVRDP) Run added in v0.9.0

type StepDownloadGuestAdditions added in v0.6.1

type StepDownloadGuestAdditions struct {
	GuestAdditionsMode   string
	GuestAdditionsURL    string
	GuestAdditionsSHA256 string
	Ctx                  interpolate.Context
}

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

Produces:

guest_additions_path string - Path to the guest additions.

func (*StepDownloadGuestAdditions) Cleanup added in v0.6.1

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

func (*StepDownloadGuestAdditions) Run added in v0.6.1

type StepExport

type StepExport struct {
	Format         string
	OutputDir      string
	ExportOpts     []string
	Bundling       VBoxBundleConfig
	SkipNatMapping bool
	SkipExport     bool
}

This step cleans up forwarded ports and exports the VM to an OVF.

Uses:

Produces:

exportPath string - The path to the resulting export.

func (*StepExport) Cleanup

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

func (*StepExport) Run

type StepForwardSSH

type StepForwardSSH struct {
	CommConfig     *communicator.Config
	HostPortMin    int
	HostPortMax    int
	SkipNatMapping bool
	// contains filtered or unexported fields
}

This step adds a NAT port forwarding definition so that SSH is available on the guest machine.

Uses:

driver Driver
ui packer.Ui
vmName string

Produces:

func (*StepForwardSSH) Cleanup

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

func (*StepForwardSSH) Run

type StepRemoveDevices

type StepRemoveDevices struct {
	Bundling                VBoxBundleConfig
	GuestAdditionsInterface string
}

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 {
	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
	Delay           time.Duration
	DisableShutdown bool
}

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 StepSshKeyPair added in v1.4.0

type StepSshKeyPair struct {
	Debug        bool
	DebugKeyPath string
	Comm         *communicator.Config
}

StepSshKeyPair executes the business logic for setting the SSH key pair in the specified communicator.Config.

func (*StepSshKeyPair) Cleanup added in v1.4.0

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

func (*StepSshKeyPair) Run added in v1.4.0

type StepSuppressMessages

type StepSuppressMessages struct{}

This step sets some variables in VirtualBox so that annoying pop-up messages don't exist.

func (StepSuppressMessages) Cleanup

func (StepSuppressMessages) Run

type StepTypeBootCommand added in v0.7.0

type StepTypeBootCommand struct {
	BootCommand   string
	BootWait      time.Duration
	VMName        string
	Ctx           interpolate.Context
	GroupInterval time.Duration
	Comm          *communicator.Config
}

func (*StepTypeBootCommand) Cleanup added in v0.7.0

func (*StepTypeBootCommand) Run added in v0.7.0

type StepUploadGuestAdditions added in v0.6.1

type StepUploadGuestAdditions struct {
	GuestAdditionsMode string
	GuestAdditionsPath string
	Ctx                interpolate.Context
}

This step uploads the guest additions ISO to the VM.

func (*StepUploadGuestAdditions) Cleanup added in v0.6.1

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

func (*StepUploadGuestAdditions) Run added in v0.6.1

type StepUploadVersion

type StepUploadVersion struct {
	Path string
}

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

func (*StepUploadVersion) Cleanup

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

func (*StepUploadVersion) Run

type StepVBoxManage

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

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

Uses:

driver Driver
ui packer.Ui
vmName string

Produces:

func (*StepVBoxManage) Cleanup

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

func (*StepVBoxManage) Run

type VBox42Driver

type VBox42Driver struct {
	// This is the path to the "VBoxManage" application.
	VBoxManagePath string
}

func (*VBox42Driver) CreateNVMeController added in v1.4.5

func (d *VBox42Driver) CreateNVMeController(vmName string, name string, portcount int) error

func (*VBox42Driver) CreateSATAController

func (d *VBox42Driver) CreateSATAController(vmName string, name string, portcount int) error

func (*VBox42Driver) CreateSCSIController added in v0.8.0

func (d *VBox42Driver) CreateSCSIController(vmName string, name string) error

func (*VBox42Driver) CreateSnapshot added in v1.4.3

func (d *VBox42Driver) CreateSnapshot(vmname string, snapshotName string) error

func (*VBox42Driver) Delete

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

func (*VBox42Driver) DeleteSnapshot added in v1.4.3

func (d *VBox42Driver) DeleteSnapshot(vmname string, sn *VBoxSnapshot) error

func (*VBox42Driver) GetCurrentSnapshot added in v1.4.3

func (d *VBox42Driver) GetCurrentSnapshot(vmname string) (*VBoxSnapshot, error)

func (*VBox42Driver) HasSnapshots added in v1.4.3

func (d *VBox42Driver) HasSnapshots(vmname string) (bool, error)

func (*VBox42Driver) Import

func (d *VBox42Driver) Import(name string, path string, flags []string) error

func (*VBox42Driver) IsRunning

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

func (*VBox42Driver) Iso added in v0.6.1

func (d *VBox42Driver) Iso() (string, error)

func (*VBox42Driver) LoadSnapshots added in v1.4.3

func (d *VBox42Driver) LoadSnapshots(vmName string) (*VBoxSnapshot, error)

LoadSnapshots load the snapshots for a VM instance

func (*VBox42Driver) SetSnapshot added in v1.4.3

func (d *VBox42Driver) SetSnapshot(vmname string, sn *VBoxSnapshot) error

func (*VBox42Driver) Stop

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

func (*VBox42Driver) SuppressMessages

func (d *VBox42Driver) SuppressMessages() error

func (*VBox42Driver) VBoxManage

func (d *VBox42Driver) VBoxManage(args ...string) error

func (*VBox42Driver) VBoxManageWithOutput added in v1.4.3

func (d *VBox42Driver) VBoxManageWithOutput(args ...string) (string, error)

func (*VBox42Driver) Verify

func (d *VBox42Driver) Verify() error

func (*VBox42Driver) Version

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

type VBoxBundleConfig added in v1.3.3

type VBoxBundleConfig struct {
	// Defaults to false. When enabled, Packer includes
	// any attached ISO disc devices into the final virtual machine. Useful for
	// some live distributions that require installation media to continue to be
	// attached after installation.
	BundleISO bool `mapstructure:"bundle_iso" required:"false"`
}

func (*VBoxBundleConfig) Prepare added in v1.3.3

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

type VBoxManageConfig

type VBoxManageConfig struct {
	// Custom `VBoxManage` commands to execute in order to further customize
	// the virtual machine being created. The value of this is an array of
	// commands to execute. The commands are executed in the order defined in
	// the template. For each command, the command is defined itself as an
	// array of strings, where each string represents a single argument on the
	// command-line to `VBoxManage` (but excluding `VBoxManage` itself). Each
	// arg is treated as a [configuration
	// template](/docs/templates/engine.html), where the `Name` variable is
	// replaced with the VM name. More details on how to use `VBoxManage` are
	// below.
	VBoxManage [][]string `mapstructure:"vboxmanage" required:"false"`
	// Identical to vboxmanage,
	// except that it is run after the virtual machine is shutdown, and before the
	// virtual machine is exported.
	VBoxManagePost [][]string `mapstructure:"vboxmanage_post" required:"false"`
}

func (*VBoxManageConfig) Prepare

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

type VBoxSnapshot added in v1.4.3

type VBoxSnapshot struct {
	Name      string
	UUID      string
	IsCurrent bool
	Parent    *VBoxSnapshot // nil if topmost (root) snapshot
	Children  []*VBoxSnapshot
}

VBoxSnapshot stores the hierarchy of snapshots for a VM instance

func ParseSnapshotData added in v1.4.3

func ParseSnapshotData(snapshotData string) (*VBoxSnapshot, error)

ParseSnapshotData parses the machinereadable representation of a virtualbox snapshot tree

func (*VBoxSnapshot) GetChildWithName added in v1.4.3

func (sn *VBoxSnapshot) GetChildWithName(name string) *VBoxSnapshot

func (*VBoxSnapshot) GetCurrentSnapshot added in v1.4.3

func (sn *VBoxSnapshot) GetCurrentSnapshot() *VBoxSnapshot

GetCurrentSnapshot returns the currently attached snapshot

func (*VBoxSnapshot) GetRoot added in v1.4.3

func (sn *VBoxSnapshot) GetRoot() *VBoxSnapshot

GetRoot returns the top-most (root) snapshot for a given snapshot

func (*VBoxSnapshot) GetSnapshotByUUID added in v1.4.3

func (sn *VBoxSnapshot) GetSnapshotByUUID(uuid string) *VBoxSnapshot

GetSnapshotByUUID returns a snapshot by it's UUID

func (*VBoxSnapshot) GetSnapshots added in v1.4.3

func (sn *VBoxSnapshot) GetSnapshots() []*VBoxSnapshot

GetSnapshots returns an array of all snapshots defined

func (*VBoxSnapshot) GetSnapshotsByName added in v1.4.3

func (sn *VBoxSnapshot) GetSnapshotsByName(name string) []*VBoxSnapshot

GetSnapshotsByName find all snapshots with a given name

func (*VBoxSnapshot) IsChildOf added in v1.4.3

func (sn *VBoxSnapshot) IsChildOf(candidate *VBoxSnapshot) bool

IsChildOf verifies if the current snaphot is a child of the passed as argument

type VBoxVersionConfig

type VBoxVersionConfig struct {
	Communicator string `mapstructure:"communicator"`
	// The path within the virtual machine to
	// upload a file that contains the VirtualBox version that was used to create
	// the machine. This information can be useful for provisioning. By default
	// this is .vbox_version, which will generally be upload it into the
	// home directory. Set to an empty string to skip uploading this file, which
	// can be useful when using the none communicator.
	VBoxVersionFile *string `mapstructure:"virtualbox_version_file" required:"false"`
}

func (*VBoxVersionConfig) Prepare

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

Jump to

Keyboard shortcuts

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