diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a2f6337f..1edb00e63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ BUG FIXES: * core: More plugin server fixes that avoid hangs on OS X 10.7 [GH-87] * virtualbox: More robust version parsing for uploading guest additions. [GH-69] +* virtualbox: Output dir and VM name defaults depend on build name, + avoiding collisions. [GH-91] +* vmware: Output dir and VM name defaults depend on build name, + avoiding collisions. [GH-91] ## 0.1.2 (June 29, 2013) diff --git a/builder/virtualbox/builder.go b/builder/virtualbox/builder.go index 8b6fc0ab3..5d1f9bcce 100644 --- a/builder/virtualbox/builder.go +++ b/builder/virtualbox/builder.go @@ -48,7 +48,8 @@ type config struct { VBoxManage [][]string `mapstructure:"vboxmanage"` VMName string `mapstructure:"vm_name"` - PackerDebug bool `mapstructure:"packer_debug"` + PackerBuildName string `mapstructure:"packer_build_name"` + PackerDebug bool `mapstructure:"packer_debug"` RawBootWait string `mapstructure:"boot_wait"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` @@ -86,7 +87,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { } if b.config.OutputDir == "" { - b.config.OutputDir = "virtualbox" + b.config.OutputDir = fmt.Sprintf("output-%s", b.config.PackerBuildName) } if b.config.RawBootWait == "" { @@ -114,7 +115,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { } if b.config.VMName == "" { - b.config.VMName = "packer" + b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName) } errs := make([]error, 0) diff --git a/builder/virtualbox/builder_test.go b/builder/virtualbox/builder_test.go index f8902a44d..eb080af47 100644 --- a/builder/virtualbox/builder_test.go +++ b/builder/virtualbox/builder_test.go @@ -13,6 +13,8 @@ func testConfig() map[string]interface{} { "iso_md5": "foo", "iso_url": "http://www.google.com/", "ssh_username": "foo", + + packer.BuildNameConfigKey: "foo", } } @@ -36,7 +38,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { t.Errorf("bad guest OS type: %s", b.config.GuestOSType) } - if b.config.OutputDir != "virtualbox" { + if b.config.OutputDir != "output-foo" { t.Errorf("bad output dir: %s", b.config.OutputDir) } @@ -52,7 +54,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { t.Errorf("bad ssh port: %d", b.config.SSHPort) } - if b.config.VMName != "packer" { + if b.config.VMName != "packer-foo" { t.Errorf("bad vm name: %s", b.config.VMName) } } diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index 5a0e2159d..d8a8f27b6 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -50,7 +50,8 @@ type config struct { VNCPortMin uint `mapstructure:"vnc_port_min"` VNCPortMax uint `mapstructure:"vnc_port_max"` - PackerDebug bool `mapstructure:"packer_debug"` + PackerBuildName string `mapstructure:"packer_build_name"` + PackerDebug bool `mapstructure:"packer_debug"` RawBootWait string `mapstructure:"boot_wait"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` @@ -78,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { } if b.config.VMName == "" { - b.config.VMName = "packer" + b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName) } if b.config.HTTPPortMin == 0 { @@ -102,7 +103,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { } if b.config.OutputDir == "" { - b.config.OutputDir = "vmware" + b.config.OutputDir = fmt.Sprintf("output-%s", b.config.PackerBuildName) } if b.config.SSHPort == 0 { diff --git a/builder/vmware/builder_test.go b/builder/vmware/builder_test.go index bc8e8a801..8d32636d8 100644 --- a/builder/vmware/builder_test.go +++ b/builder/vmware/builder_test.go @@ -13,6 +13,8 @@ func testConfig() map[string]interface{} { "iso_md5": "foo", "iso_url": "http://www.packer.io", "ssh_username": "foo", + + packer.BuildNameConfigKey: "foo", } } @@ -66,7 +68,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { t.Errorf("bad disk name: %s", b.config.DiskName) } - if b.config.OutputDir != "vmware" { + if b.config.OutputDir != "output-foo" { t.Errorf("bad output dir: %s", b.config.OutputDir) } @@ -74,7 +76,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { t.Errorf("bad wait timeout: %s", b.config.SSHWaitTimeout) } - if b.config.VMName != "packer" { + if b.config.VMName != "packer-foo" { t.Errorf("bad vm name: %s", b.config.VMName) } }