1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

isolate chocolatey bootstrapper execution

fixes #2742
added output capture/return, exit code check to bootstrapper exec
This commit is contained in:
nitzmahone 2016-08-17 15:47:44 -07:00 committed by Matt Clay
parent fa511fa763
commit a2f9e0d2fe

View file

@ -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"
}