From 67ffde4ac1be60cc851709df6a4ea2f31861610e Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 7 Mar 2018 08:40:57 +1000 Subject: [PATCH] win_wait_for: use loopback IP instead of hostname if 127.0.0.1 is used (#36762) * win_wait_for: use loopback IP instead of hostname if 127.0.0.1 is used * removed reverse dns lookup in port check --- lib/ansible/modules/windows/win_wait_for.ps1 | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/ansible/modules/windows/win_wait_for.ps1 b/lib/ansible/modules/windows/win_wait_for.ps1 index dee606ff33e..66fd884deaf 100644 --- a/lib/ansible/modules/windows/win_wait_for.ps1 +++ b/lib/ansible/modules/windows/win_wait_for.ps1 @@ -54,17 +54,9 @@ if ($port -ne $null) { } Function Test-Port($hostname, $port) { - # try and resolve the IP/Host, if it fails then just use the host passed in - try { - $resolve_hostname = ([System.Net.Dns]::GetHostEntry($hostname)).HostName - } catch { - # oh well just use the IP addres - $resolve_hostname = $hostname - } - $timeout = $connect_timeout * 1000 $socket = New-Object -TypeName System.Net.Sockets.TcpClient - $connect = $socket.BeginConnect($resolve_hostname, $port, $null, $null) + $connect = $socket.BeginConnect($hostname, $port, $null, $null) $wait = $connect.AsyncWaitHandle.WaitOne($timeout, $false) if ($wait) {