This commit is contained in:
Megan Marsh 2019-02-08 09:28:10 -08:00
parent 07c0c599e0
commit e2d8c0bfd7
4 changed files with 33 additions and 16 deletions

View File

@ -84,7 +84,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
ImportFlags: b.config.ImportFlags, ImportFlags: b.config.ImportFlags,
}, },
&vboxcommon.StepAttachGuestAdditions{ &vboxcommon.StepAttachGuestAdditions{
GuestAdditionsMode: b.config.GuestAdditionsMode, GuestAdditionsMode: b.config.GuestAdditionsMode,
GuestAdditionsInterface: b.config.GuestAdditionsInterface,
}, },
&vboxcommon.StepConfigureVRDP{ &vboxcommon.StepConfigureVRDP{
VRDPBindAddress: b.config.VRDPBindAddress, VRDPBindAddress: b.config.VRDPBindAddress,
@ -136,7 +137,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Timeout: b.config.ShutdownTimeout, Timeout: b.config.ShutdownTimeout,
Delay: b.config.PostShutdownDelay, Delay: b.config.PostShutdownDelay,
}, },
new(vboxcommon.StepRemoveDevices), &vboxcommon.StepRemoveDevices{
GuestAdditionsInterface: b.config.GuestAdditionsInterface,
},
&vboxcommon.StepVBoxManage{ &vboxcommon.StepVBoxManage{
Commands: b.config.VBoxManagePost, Commands: b.config.VBoxManagePost,
Ctx: b.config.ctx, Ctx: b.config.ctx,

View File

@ -1,4 +1,4 @@
package ovf Gpackage ovf
import ( import (
"fmt" "fmt"
@ -28,19 +28,20 @@ type Config struct {
vboxcommon.VBoxManagePostConfig `mapstructure:",squash"` vboxcommon.VBoxManagePostConfig `mapstructure:",squash"`
vboxcommon.VBoxVersionConfig `mapstructure:",squash"` vboxcommon.VBoxVersionConfig `mapstructure:",squash"`
Checksum string `mapstructure:"checksum"` Checksum string `mapstructure:"checksum"`
ChecksumType string `mapstructure:"checksum_type"` ChecksumType string `mapstructure:"checksum_type"`
GuestAdditionsMode string `mapstructure:"guest_additions_mode"` GuestAdditionsMode string `mapstructure:"guest_additions_mode"`
GuestAdditionsPath string `mapstructure:"guest_additions_path"` GuestAdditionsPath string `mapstructure:"guest_additions_path"`
GuestAdditionsSHA256 string `mapstructure:"guest_additions_sha256"` GuestAdditionsInterface string `mapstructure:"guest_additions_interface"`
GuestAdditionsURL string `mapstructure:"guest_additions_url"` GuestAdditionsSHA256 string `mapstructure:"guest_additions_sha256"`
ImportFlags []string `mapstructure:"import_flags"` GuestAdditionsURL string `mapstructure:"guest_additions_url"`
ImportOpts string `mapstructure:"import_opts"` ImportFlags []string `mapstructure:"import_flags"`
SourcePath string `mapstructure:"source_path"` ImportOpts string `mapstructure:"import_opts"`
TargetPath string `mapstructure:"target_path"` SourcePath string `mapstructure:"source_path"`
VMName string `mapstructure:"vm_name"` TargetPath string `mapstructure:"target_path"`
KeepRegistered bool `mapstructure:"keep_registered"` VMName string `mapstructure:"vm_name"`
SkipExport bool `mapstructure:"skip_export"` KeepRegistered bool `mapstructure:"keep_registered"`
SkipExport bool `mapstructure:"skip_export"`
ctx interpolate.Context ctx interpolate.Context
} }
@ -72,6 +73,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
if c.GuestAdditionsPath == "" { if c.GuestAdditionsPath == "" {
c.GuestAdditionsPath = "VBoxGuestAdditions.iso" c.GuestAdditionsPath = "VBoxGuestAdditions.iso"
} }
if b.config.GuestAdditionsInterface == "" {
b.config.GuestAdditionsInterface = "ide"
}
if c.VMName == "" { if c.VMName == "" {
c.VMName = fmt.Sprintf( c.VMName = fmt.Sprintf(

View File

@ -164,6 +164,12 @@ builder.
- `format` (string) - Either `ovf` or `ova`, this specifies the output format - `format` (string) - Either `ovf` or `ova`, this specifies the output format
of the exported virtual machine. This defaults to `ovf`. of the exported virtual machine. This defaults to `ovf`.
- `guest_additions_interface` (string) - The interface type to use to mount
guest additions when `guest_additions_mode` is set to `attach`. Will
default to the value set in `iso_interface`, if `iso_interface` is set.
Will default to "ide", if `iso_interface` is not set. Options are "ide" and
"sata".
- `guest_additions_mode` (string) - The method by which guest additions are - `guest_additions_mode` (string) - The method by which guest additions are
made available to the guest for installation. Valid options are `upload`, made available to the guest for installation. Valid options are `upload`,
`attach`, or `disable`. If the mode is `attach` the guest additions ISO will `attach`, or `disable`. If the mode is `attach` the guest additions ISO will

View File

@ -152,6 +152,10 @@ builder.
- `format` (string) - Either `ovf` or `ova`, this specifies the output format - `format` (string) - Either `ovf` or `ova`, this specifies the output format
of the exported virtual machine. This defaults to `ovf`. of the exported virtual machine. This defaults to `ovf`.
- `guest_additions_interface` (string) - The interface type to use to mount
guest additions when `guest_additions_mode` is set to `attach`. Will
default to "ide" if not set. Options are "ide" and "sata".
- `guest_additions_mode` (string) - The method by which guest additions are - `guest_additions_mode` (string) - The method by which guest additions are
made available to the guest for installation. Valid options are `upload`, made available to the guest for installation. Valid options are `upload`,
`attach`, or `disable`. If the mode is `attach` the guest additions ISO will `attach`, or `disable`. If the mode is `attach` the guest additions ISO will