win_chocolatey: Fix hang on missing/required base env vars (#51154)

* win_chocolatey: Fix crash on missing/required base env vars

* Add changelog fragment

(cherry picked from commit 5540d66747)
This commit is contained in:
John Nelson 2019-01-21 17:13:02 -07:00 committed by Toshio Kuratomi
parent b2fbd7fd35
commit e44468738f
2 changed files with 3 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- win_chocolatey - Fix hang when used with proxy for the first time - https://github.com/ansible/ansible/issues/47669

View file

@ -190,6 +190,7 @@ Function Install-Chocolatey {
if ($proxy_url) {
# the env values are used in the install.ps1 script when getting
# external dependencies
$environment = [Environment]::GetEnvironmentVariables()
$environment.chocolateyProxyLocation = $proxy_url
$web_proxy = New-Object -TypeName System.Net.WebProxy -ArgumentList $proxy_url, $true
$client.Proxy = $web_proxy