From 6fcbfcf6b6139a3437acf5cb986335ed4f1e4f24 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 7 Feb 2019 10:51:11 +1000 Subject: [PATCH] win_rds: wait for reboot to be complete (#51849) --- test/integration/targets/win_rds/tasks/main.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/integration/targets/win_rds/tasks/main.yml b/test/integration/targets/win_rds/tasks/main.yml index 82a7275bd1d..5510b8cda95 100644 --- a/test/integration/targets/win_rds/tasks/main.yml +++ b/test/integration/targets/win_rds/tasks/main.yml @@ -19,9 +19,24 @@ - name: reboot server if needed win_reboot: - post_reboot_delay: 10 when: rds_install.reboot_required + # After a reboot Windows is still configuring the feature, this is a hack to wait until that is finished + - name: wait for component servicing to be finished + win_shell: | + $start = Get-Date + $path = "HKLM:\SYSTEM\CurrentControlSet\Control\Winlogon\Notifications\Components\TrustedInstaller" + $tries = 0 + while ((Get-ItemProperty -Path $path -Name Events).Events.Contains("CreateSession")) { + $tries += 1 + Start-Sleep -Seconds 5 + if (((Get-Date) - $start).TotalSeconds -gt 180) { + break + } + } + $tries + changed_when: False + - name: run win_rds_cap integration tests include_tasks: win_rds_cap.yml