Skip to content

Commit

Permalink
win_wait_for - fix typo found in state=drained
Browse files Browse the repository at this point in the history
  • Loading branch information
jborean93 committed Dec 13, 2022
1 parent 4a45d3b commit 9eb309f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/win_wait_for-drained.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- win_wait_for - fix incorrect function name during ``state=drained`` - https://github.com/ansible-collections/ansible.windows/issues/451
2 changes: 1 addition & 1 deletion plugins/modules/win_wait_for.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ elseif ($null -ne $port) {
$complete = $false
while (((Get-Date) - $start_time).TotalSeconds -lt $timeout) {
$attempts += 1
$active_connections = Get-PortConnections -hostname $hostname -port $port
$active_connections = Get-PortConnection -hostname $hostname -port $port
if ($null -eq $active_connections) {
$complete = $true
break
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ErrorActionPreference = 'Stop'

$port = { { test_win_wait_for_port } }
$port = [int]$args[0]

$endpoint = New-Object -TypeName System.Net.IPEndPoint([System.Net.IPAddress]::Parse("0.0.0.0"), $port)
$listener = New-Object -TypeName System.Net.Sockets.TcpListener($endpoint)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/targets/win_wait_for/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
path: '{{test_win_wait_for_path}}'
state: directory

- name: template out the test server
win_template:
- name: copy out the test server
win_copy:
src: http-server.ps1
dest: '{{test_win_wait_for_path}}\http-server.ps1'

Expand Down Expand Up @@ -241,7 +241,7 @@
- fail_timeout_port_online.elapsed > 5

- name: run async task to start web server
win_shell: Start-Sleep -Seconds 5; {{test_win_wait_for_path}}\http-server.ps1
win_shell: Start-Sleep -Seconds 5; {{test_win_wait_for_path}}\http-server.ps1 {{ test_win_wait_for_port }}
async: 30
poll: 0

Expand All @@ -257,7 +257,7 @@
- wait_for_port_to_start.wait_attempts > 1

- name: start web server
win_shell: '{{test_win_wait_for_path}}\http-server.ps1'
win_shell: '{{test_win_wait_for_path}}\http-server.ps1 {{ test_win_wait_for_port }}'
async: 30
poll: 0

Expand Down Expand Up @@ -290,7 +290,7 @@
- wait_for_port_already_stopped.wait_attempts == 1

- name: start web server for offline port test
win_shell: '{{test_win_wait_for_path}}\http-server.ps1'
win_shell: '{{test_win_wait_for_path}}\http-server.ps1 {{ test_win_wait_for_port }}'
async: 30
poll: 0

Expand Down

0 comments on commit 9eb309f

Please sign in to comment.