builder/vmware: don't cache ip address so we know if it changes

This commit is contained in:
Matthew Hooker 2017-02-09 23:16:40 -08:00
parent 10c001250a
commit 29dd20da68
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
2 changed files with 0 additions and 13 deletions

View File

@ -248,12 +248,7 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
port = sshc.WinRMPort port = sshc.WinRMPort
} }
if address, ok := state.GetOk("vm_address"); ok {
return address.(string), nil
}
if address := config.CommConfig.Host(); address != "" { if address := config.CommConfig.Host(); address != "" {
state.Put("vm_address", address)
return address, nil return address, nil
} }
@ -302,7 +297,6 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
} else { } else {
defer conn.Close() defer conn.Close()
address := record["IPAddress"] address := record["IPAddress"]
state.Put("vm_address", address)
return address, nil return address, nil
} }
} }

View File

@ -88,11 +88,4 @@ func TestESX5Driver_CommHost(t *testing.T) {
if host != expected_host { if host != expected_host {
t.Errorf("bad host name: %s", host) t.Errorf("bad host name: %s", host)
} }
address, ok := state.GetOk("vm_address")
if !ok {
t.Error("state not updated with vm_address")
}
if address.(string) != expected_host {
t.Errorf("bad vm_address: %s", address.(string))
}
} }