summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authornitzmahone <mdavis@ansible.com>2016-08-17 15:47:44 -0700
committernitzmahone <mdavis@ansible.com>2016-08-17 15:47:44 -0700
commit0d8a7b875e7e59ef197297b7b6d79f83de4f7c29 (patch)
tree8ecf1844afda6da7f0c4bcdc41873fd5787c8fa4 /windows
parent75669a4d0b543490145814b37255b0cb78e3505b (diff)
downloadansible-modules-extras-0d8a7b875e7e59ef197297b7b6d79f83de4f7c29.tar.gz
isolate chocolatey bootstrapper execution
fixes #2742 added output capture/return, exit code check to bootstrapper exec
Diffstat (limited to 'windows')
-rw-r--r--windows/win_chocolatey.ps17
1 files changed, 6 insertions, 1 deletions
diff --git a/windows/win_chocolatey.ps1 b/windows/win_chocolatey.ps1
index e725519b..bf5418ab 100644
--- a/windows/win_chocolatey.ps1
+++ b/windows/win_chocolatey.ps1
@@ -59,7 +59,12 @@ Function Chocolatey-Install-Upgrade
if ($ChocoAlreadyInstalled -eq $null)
{
#We need to install chocolatey
- iex ((new-object net.webclient).DownloadString("https://chocolatey.org/install.ps1"))
+ $install_output = (new-object net.webclient).DownloadString("https://chocolatey.org/install.ps1") | powershell -
+ if ($LASTEXITCODE -ne 0)
+ {
+ Set-Attr $result "choco_bootstrap_output" $install_output
+ Fail-Json $result "Chocolatey bootstrap installation failed."
+ }
$result.changed = $true
$script:executable = "C:\ProgramData\chocolatey\bin\choco.exe"
}