builder/vmware: default boot_wait

This commit is contained in:
Mitchell Hashimoto 2013-06-28 22:40:55 -04:00
parent 1ffae8ad93
commit e4ad595c90
3 changed files with 17 additions and 1 deletions

View File

@ -8,6 +8,7 @@ BUG FIXES:
* virtualbox: `boot_wait` defaults to "10s" rather than 0. [GH-44]
* virtualbox: if `http_port_min` and max are the same, it will no longer
panic [GH-53]
* vmware: `boot_wait` defaults to "10s" rather than 0. [GH-44]
* vmware: if `http_port_min` and max are the same, it will no longer
panic [GH-53]

View File

@ -86,6 +86,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b.config.HTTPPortMax = 9000
}
if b.config.RawBootWait == "" {
b.config.RawBootWait = "10s"
}
if b.config.VNCPortMin == 0 {
b.config.VNCPortMin = 5900
}

View File

@ -28,9 +28,20 @@ func TestBuilderPrepare_BootWait(t *testing.T) {
var b Builder
config := testConfig()
// Test a default boot_wait
delete(config, "boot_wait")
err := b.Prepare(config)
if err != nil {
t.Fatalf("err: %s", err)
}
if b.config.RawBootWait != "10s" {
t.Fatalf("bad value: %s", b.config.RawBootWait)
}
// Test with a bad boot_wait
config["boot_wait"] = "this is not good"
err := b.Prepare(config)
err = b.Prepare(config)
if err == nil {
t.Fatal("should have error")
}