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:
commit
ed92055372
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue