builder/vmware: don't cache ip address so we know if it changes
This commit is contained in:
parent
10c001250a
commit
29dd20da68
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue