From 6f68db5c1a8cc6eb940fc956045d4d28051b9130 Mon Sep 17 00:00:00 2001 From: Marcin Dobosz Date: Fri, 16 Oct 2015 13:48:32 -0700 Subject: [PATCH] Fix win_iis_webapppool module to not null ref when removing an apppool using PS4 --- .../extras/windows/win_iis_webapppool.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_iis_webapppool.ps1 b/lib/ansible/modules/extras/windows/win_iis_webapppool.ps1 index 6dcf7ec192c..858a151f2a3 100644 --- a/lib/ansible/modules/extras/windows/win_iis_webapppool.ps1 +++ b/lib/ansible/modules/extras/windows/win_iis_webapppool.ps1 @@ -101,12 +101,15 @@ try { # Result $pool = Get-Item IIS:\AppPools\$name -$result.info = @{ - name = $pool.Name - state = $pool.State - attributes = New-Object psobject @{} -}; - -$pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)}; +if ($pool) +{ + $result.info = @{ + name = $pool.Name + state = $pool.State + attributes = New-Object psobject @{} + }; + + $pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)}; +} Exit-Json $result