From 01b36130a8df0f6902d95c00c013c9bc6e47de4d Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 6 Jul 2015 09:59:51 -0500 Subject: [PATCH] use convertto-bool for rm and recurse params --- .../modules/extras/windows/win_unzip.ps1 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_unzip.ps1 b/lib/ansible/modules/extras/windows/win_unzip.ps1 index e4509a290a2..a62f246f5c8 100644 --- a/lib/ansible/modules/extras/windows/win_unzip.ps1 +++ b/lib/ansible/modules/extras/windows/win_unzip.ps1 @@ -62,19 +62,18 @@ Else { Fail-Json $result "missing required argument: dest" } -If ($params.recurse -eq "true" -Or $params.recurse -eq "yes") { - $recurse = $true +If ($params.recurse) { + $recurse = ConvertTo-Bool ($params.recurse) } Else { $recurse = $false } -If ($params.rm -eq "true" -Or $params.rm -eq "yes"){ - $rm = $true - Set-Attr $result.win_unzip "rm" "true" -} -Else { - $rm = $false +If ($params.rm) { + $rm = ConvertTo-Bool ($params.rm) +} +Else { + $rm = $false } If ($ext -eq ".zip" -And $recurse -eq $false) { @@ -111,7 +110,7 @@ Else { If ($recurse) { Expand-Archive -Path $src -OutputPath $dest -Force - If ($rm) { + If ($rm -eq $true) { Get-ChildItem $dest -recurse | Where {$_.extension -eq ".gz" -Or $_.extension -eq ".zip" -Or $_.extension -eq ".bz2" -Or $_.extension -eq ".tar" -Or $_.extension -eq ".msu"} | % { Expand-Archive $_.FullName -OutputPath $dest -Force Remove-Item $_.FullName -Force