Commit d6004564 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox: fix interpolation weirdness

parent 54e081d5
...@@ -57,8 +57,12 @@ type Config struct { ...@@ -57,8 +57,12 @@ type Config struct {
} }
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
// Set some defaults
b.config.VMName = fmt.Sprintf("packer-%s-{{timestamp}}", b.config.PackerBuildName)
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{ Exclude: []string{
"boot_command", "boot_command",
...@@ -112,10 +116,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { ...@@ -112,10 +116,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b.config.ISOInterface = "ide" b.config.ISOInterface = "ide"
} }
if b.config.VMName == "" {
b.config.VMName = fmt.Sprintf("packer-%s-{{timestamp}}", b.config.PackerBuildName)
}
if b.config.HardDriveInterface != "ide" && b.config.HardDriveInterface != "sata" && b.config.HardDriveInterface != "scsi" { if b.config.HardDriveInterface != "ide" && b.config.HardDriveInterface != "sata" && b.config.HardDriveInterface != "scsi" {
errs = packer.MultiErrorAppend( errs = packer.MultiErrorAppend(
errs, errors.New("hard_drive_interface can only be ide, sata, or scsi")) errs, errors.New("hard_drive_interface can only be ide, sata, or scsi"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment