diff options
author | Phil <schwartzmx@gmail.com> | 2015-06-22 18:51:58 -0500 |
---|---|---|
committer | Phil <schwartzmx@gmail.com> | 2015-06-23 07:40:14 -0500 |
commit | 03ce40a62ebb1d8ceb8d2f6f7bebb1b4b90458c0 (patch) | |
tree | d3ef79dca63f1a31649113aa2e78f20accc2a53c /windows/win_unzip.ps1 | |
parent | 92744ef5581d108eba3e17d539fc810de2a36e5f (diff) | |
download | ansible-modules-extras-03ce40a62ebb1d8ceb8d2f6f7bebb1b4b90458c0.tar.gz |
removes restart functionality, and added creates param for idempotency
Diffstat (limited to 'windows/win_unzip.ps1')
-rw-r--r-- | windows/win_unzip.ps1 | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/windows/win_unzip.ps1 b/windows/win_unzip.ps1 index 51b092f4..e4509a29 100644 --- a/windows/win_unzip.ps1 +++ b/windows/win_unzip.ps1 @@ -26,6 +26,13 @@ $result = New-Object psobject @{ changed = $false } +If ($params.creates) { + If (Test-Path $params.creates) { + Exit-Json $result "The 'creates' file or directory already exists." + } + +} + If ($params.src) { $src = $params.src.toString() @@ -86,7 +93,7 @@ Else { $list = Get-Module -ListAvailable If (-Not ($list -match "PSCX")) { - Fail-Json "PowerShellCommunityExtensions PowerShell Module (PSCX) is required for non-'.zip' compressed archive types." + Fail-Json $result "PowerShellCommunityExtensions PowerShell Module (PSCX) is required for non-'.zip' compressed archive types." } Else { Set-Attr $result.win_unzip "pscx_status" "present" @@ -122,10 +129,10 @@ Else { } Catch { If ($recurse) { - Fail-Json "Error recursively expanding $src to $dest" + Fail-Json $result "Error recursively expanding $src to $dest" } Else { - Fail-Json "Error expanding $src to $dest" + Fail-Json $result "Error expanding $src to $dest" } } } @@ -135,11 +142,6 @@ If ($rm -eq $true){ Set-Attr $result.win_unzip "rm" "true" } -If ($params.restart -eq "true" -Or $params.restart -eq "yes") { - Restart-Computer -Force - Set-Attr $result.win_unzip "restart" "true" -} - # Fixes a fail error message (when the task actually succeeds) for a "Convert-ToJson: The converted JSON string is in bad format" # This happens when JSON is parsing a string that ends with a "\", which is possible when specifying a directory to download to. # This catches that possible error, before assigning the JSON $result |