From b3ffcd7c6c2204faac070ba1363e096d101e3a13 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Kliemeck Date: Fri, 20 Nov 2015 09:08:42 +0100 Subject: [PATCH] fix race condition and missing property --- lib/ansible/modules/extras/windows/win_updates.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/windows/win_updates.ps1 b/lib/ansible/modules/extras/windows/win_updates.ps1 index 3d5bc4c57c..890e3670d8 100644 --- a/lib/ansible/modules/extras/windows/win_updates.ps1 +++ b/lib/ansible/modules/extras/windows/win_updates.ps1 @@ -337,7 +337,7 @@ Function RunAsScheduledJob { $sw = [System.Diagnostics.Stopwatch]::StartNew() # NB: output from scheduled jobs is delayed after completion (including the sub-objects after the primary Output object is available) - While (($job.Output -eq $null -or -not $job.Output.Keys.Contains('job_output')) -and $sw.ElapsedMilliseconds -lt 15000) { + While (($job.Output -eq $null -or -not ($job.Output | Get-Member -Name Keys) -or -not $job.Output.Keys.Contains('job_output')) -and $sw.ElapsedMilliseconds -lt 15000) { Write-DebugLog "Waiting for job output to populate..." Start-Sleep -Milliseconds 500 }