Merge pull request #8877 from paulcichonski/remote-esxi-bastion

vmware-iso esxi: Do not test if NIC is reachable when ssh bastion is required
This commit is contained in:
Megan Marsh 2020-03-13 11:40:40 -07:00 committed by GitHub
commit 56045619d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -495,6 +495,15 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
if record["IPAddress"] == "0.0.0.0" { if record["IPAddress"] == "0.0.0.0" {
continue continue
} }
// if ssh is going through a bastion, we can't easily check if the nic is reachable on the network
// so just pick the first one that is not 0.0.0.0
if sshc.SSHBastionHost != "" {
address := record["IPAddress"]
state.Put("vm_address", address)
return address, nil
}
// When multiple NICs are connected to the same network, choose // When multiple NICs are connected to the same network, choose
// one that has a route back. This Dial should ensure that. // one that has a route back. This Dial should ensure that.
conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", record["IPAddress"], port), 2*time.Second) conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", record["IPAddress"], port), 2*time.Second)