Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_wait_for - fix typo found in state=drained #458

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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