Merge pull request #4532 from mitchellh/vmipgetagain

builder/vmware: don't cache ip address so we know if it changes
This commit is contained in:
Matthew Hooker 2017-02-26 18:46:46 -08:00 committed by GitHub
commit ed92055372
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
}
if address, ok := state.GetOk("vm_address"); ok {
return address.(string), nil
}
if address := config.CommConfig.Host(); address != "" {
state.Put("vm_address", address)
return address, nil
}
@ -302,7 +297,6 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
} else {
defer conn.Close()
address := record["IPAddress"]
state.Put("vm_address", address)
return address, nil
}
}

View File

@ -88,11 +88,4 @@ func TestESX5Driver_CommHost(t *testing.T) {
if host != expected_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))
}
}