From 17f160244fd5d3d0c31559a520049a5dbcba34af Mon Sep 17 00:00:00 2001 From: Phil Schwartz Date: Wed, 31 Dec 2014 10:34:32 -0600 Subject: [PATCH] edit check for extension to use library func --- lib/ansible/modules/extras/windows/win_unzip.ps1 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_unzip.ps1 b/lib/ansible/modules/extras/windows/win_unzip.ps1 index e76c51dc6aa..6772792be08 100644 --- a/lib/ansible/modules/extras/windows/win_unzip.ps1 +++ b/lib/ansible/modules/extras/windows/win_unzip.ps1 @@ -41,7 +41,7 @@ If (-Not($params.dest -eq $null)) { $dest = $params.dest.toString() If (-Not (Test-Path $dest -PathType Container)){ - Try{ + Try{ New-Item -itemtype directory -path $dest } Catch { @@ -54,18 +54,14 @@ Else { } Try { - cd C:\ $shell = New-Object -ComObject Shell.Application $shell.NameSpace($dest).copyhere(($shell.NameSpace($zip)).items(), 20) $result.changed = $true } Catch { - $sp = $zip.split(".") - $ext = $sp[$sp.length-1] - # Used to allow reboot after exe hotfix extraction (Windows 2008 R2 SP1) # This will have no effect in most cases. - If (-Not ($ext -eq "exe")){ + If (-Not ([System.IO.Path]::GetExtension($zip) -match ".exe")){ $result.changed = $false Fail-Json $result "Error unzipping $zip to $dest" }