Commit bac97633 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox, builder/vmware: output and VM name based on build

[GH-91]
parent 12f62719
...@@ -14,6 +14,10 @@ BUG FIXES: ...@@ -14,6 +14,10 @@ BUG FIXES:
* core: More plugin server fixes that avoid hangs on OS X 10.7 [GH-87] * 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: 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) ## 0.1.2 (June 29, 2013)
......
...@@ -48,7 +48,8 @@ type config struct { ...@@ -48,7 +48,8 @@ type config struct {
VBoxManage [][]string `mapstructure:"vboxmanage"` VBoxManage [][]string `mapstructure:"vboxmanage"`
VMName string `mapstructure:"vm_name"` 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"` RawBootWait string `mapstructure:"boot_wait"`
RawShutdownTimeout string `mapstructure:"shutdown_timeout"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"`
...@@ -86,7 +87,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -86,7 +87,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
} }
if b.config.OutputDir == "" { if b.config.OutputDir == "" {
b.config.OutputDir = "virtualbox" b.config.OutputDir = fmt.Sprintf("output-%s", b.config.PackerBuildName)
} }
if b.config.RawBootWait == "" { if b.config.RawBootWait == "" {
...@@ -114,7 +115,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -114,7 +115,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
} }
if b.config.VMName == "" { if b.config.VMName == "" {
b.config.VMName = "packer" b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName)
} }
errs := make([]error, 0) errs := make([]error, 0)
......
...@@ -13,6 +13,8 @@ func testConfig() map[string]interface{} { ...@@ -13,6 +13,8 @@ func testConfig() map[string]interface{} {
"iso_md5": "foo", "iso_md5": "foo",
"iso_url": "http://www.google.com/", "iso_url": "http://www.google.com/",
"ssh_username": "foo", "ssh_username": "foo",
packer.BuildNameConfigKey: "foo",
} }
} }
...@@ -36,7 +38,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { ...@@ -36,7 +38,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Errorf("bad guest OS type: %s", b.config.GuestOSType) 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) t.Errorf("bad output dir: %s", b.config.OutputDir)
} }
...@@ -52,7 +54,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { ...@@ -52,7 +54,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Errorf("bad ssh port: %d", b.config.SSHPort) 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) t.Errorf("bad vm name: %s", b.config.VMName)
} }
} }
......
...@@ -50,7 +50,8 @@ type config struct { ...@@ -50,7 +50,8 @@ type config struct {
VNCPortMin uint `mapstructure:"vnc_port_min"` VNCPortMin uint `mapstructure:"vnc_port_min"`
VNCPortMax uint `mapstructure:"vnc_port_max"` 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"` RawBootWait string `mapstructure:"boot_wait"`
RawShutdownTimeout string `mapstructure:"shutdown_timeout"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"`
...@@ -78,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -78,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
} }
if b.config.VMName == "" { if b.config.VMName == "" {
b.config.VMName = "packer" b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName)
} }
if b.config.HTTPPortMin == 0 { if b.config.HTTPPortMin == 0 {
...@@ -102,7 +103,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -102,7 +103,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
} }
if b.config.OutputDir == "" { if b.config.OutputDir == "" {
b.config.OutputDir = "vmware" b.config.OutputDir = fmt.Sprintf("output-%s", b.config.PackerBuildName)
} }
if b.config.SSHPort == 0 { if b.config.SSHPort == 0 {
......
...@@ -13,6 +13,8 @@ func testConfig() map[string]interface{} { ...@@ -13,6 +13,8 @@ func testConfig() map[string]interface{} {
"iso_md5": "foo", "iso_md5": "foo",
"iso_url": "http://www.packer.io", "iso_url": "http://www.packer.io",
"ssh_username": "foo", "ssh_username": "foo",
packer.BuildNameConfigKey: "foo",
} }
} }
...@@ -66,7 +68,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { ...@@ -66,7 +68,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Errorf("bad disk name: %s", b.config.DiskName) 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) t.Errorf("bad output dir: %s", b.config.OutputDir)
} }
...@@ -74,7 +76,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) { ...@@ -74,7 +76,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Errorf("bad wait timeout: %s", b.config.SSHWaitTimeout) 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) t.Errorf("bad vm name: %s", b.config.VMName)
} }
} }
......
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