|
|
|
@ -36,7 +36,7 @@ if ($path -ne $null) {
|
|
|
|
|
if ($state -in @("stopped","drained")) {
|
|
|
|
|
Fail-Json $result "state=$state should only be used for checking a port in the win_wait_for module"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($exclude_hosts -ne $null) {
|
|
|
|
|
Fail-Json $result "exclude_hosts should only be used when checking a port and state=drained in the win_wait_for module"
|
|
|
|
|
}
|
|
|
|
@ -84,7 +84,7 @@ Function Get-PortConnections($hostname, $port) {
|
|
|
|
|
} else {
|
|
|
|
|
$active_connections = $conn_info.GetActiveTcpConnections() | Where-Object { $_.LocalEndPoint.Address -eq $hostname -and $_.LocalEndPoint.Port -eq $port }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($active_connections -ne $null) {
|
|
|
|
|
foreach ($active_connection in $active_connections) {
|
|
|
|
|
$connections += $active_connection.RemoteEndPoint.Address
|
|
|
|
@ -101,7 +101,7 @@ if ($delay -ne $null) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$attempts = 0
|
|
|
|
|
if ($path -eq $null -and $port -eq $null -and $state -eq "drained") {
|
|
|
|
|
if ($path -eq $null -and $port -eq $null -and $state -ne "drained") {
|
|
|
|
|
Start-Sleep -Seconds $timeout
|
|
|
|
|
} elseif ($path -ne $null) {
|
|
|
|
|
if ($state -in @("present", "started")) {
|
|
|
|
@ -133,7 +133,7 @@ if ($path -eq $null -and $port -eq $null -and $state -eq "drained") {
|
|
|
|
|
Fail-Json $result "timeout while waiting for file $path to be present"
|
|
|
|
|
} else {
|
|
|
|
|
Fail-Json $result "timeout while waiting for string regex $search_regex in file $path to match"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} elseif ($state -in @("absent")) {
|
|
|
|
|
# check if the file is deleted or string doesn't exist in file
|
|
|
|
@ -165,7 +165,7 @@ if ($path -eq $null -and $port -eq $null -and $state -eq "drained") {
|
|
|
|
|
Fail-Json $result "timeout while waiting for file $path to be absent"
|
|
|
|
|
} else {
|
|
|
|
|
Fail-Json $result "timeout while waiting for string regex $search_regex in file $path to not match"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} elseif ($port -ne $null) {
|
|
|
|
@ -252,7 +252,7 @@ if ($path -eq $null -and $port -eq $null -and $state -eq "drained") {
|
|
|
|
|
$result.elapsed = $elapsed_seconds
|
|
|
|
|
Fail-Json $result "timeout while waiting for $($hostname):$port to drain"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result.wait_attempts = $attempts
|
|
|
|
|