From e44468738f65ecfae4756db2325d2bdad0677e49 Mon Sep 17 00:00:00 2001 From: John Nelson Date: Mon, 21 Jan 2019 17:13:02 -0700 Subject: [PATCH] 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 5540d667476665a2965ecdfca8d37a59a033a4eb) --- changelogs/fragments/win_chocolatey.yaml | 2 ++ lib/ansible/modules/windows/win_chocolatey.ps1 | 1 + 2 files changed, 3 insertions(+) create mode 100644 changelogs/fragments/win_chocolatey.yaml diff --git a/changelogs/fragments/win_chocolatey.yaml b/changelogs/fragments/win_chocolatey.yaml new file mode 100644 index 0000000000..65677f8333 --- /dev/null +++ b/changelogs/fragments/win_chocolatey.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_chocolatey - Fix hang when used with proxy for the first time - https://github.com/ansible/ansible/issues/47669 diff --git a/lib/ansible/modules/windows/win_chocolatey.ps1 b/lib/ansible/modules/windows/win_chocolatey.ps1 index b034ac3cb5..6b63a556c7 100644 --- a/lib/ansible/modules/windows/win_chocolatey.ps1 +++ b/lib/ansible/modules/windows/win_chocolatey.ps1 @@ -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