From f82bcbcce311957b4532f86002408d56beca4998 Mon Sep 17 00:00:00 2001 From: Patrick Wright Date: Wed, 17 May 2017 09:37:31 -0700 Subject: [PATCH] update powershell proxy selection Signed-off-by: Patrick Wright --- lib/mixlib/install/generator/powershell.rb | 4 +++- .../install/generator/powershell/scripts/helpers.ps1.erb | 2 +- .../install/generator/powershell/scripts/install_project.ps1 | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/mixlib/install/generator/powershell.rb b/lib/mixlib/install/generator/powershell.rb index eaa15d59..6cdb31bb 100644 --- a/lib/mixlib/install/generator/powershell.rb +++ b/lib/mixlib/install/generator/powershell.rb @@ -71,7 +71,9 @@ def render_command cmd << " -version #{options.product_version}" cmd << " -channel #{options.channel}" cmd << " -architecture #{options.architecture}" if options.architecture - cmd << " -http_proxy #{options.http_proxy}" if options.http_proxy + # Use options.proxy to determine which proxy option to use since + # WebProxy doesn't differentiate between http/https + cmd << " -http_proxy #{options.http_proxy}" if options.proxy cmd << install_command_params if options.install_command_options cmd << "\n" end diff --git a/lib/mixlib/install/generator/powershell/scripts/helpers.ps1.erb b/lib/mixlib/install/generator/powershell/scripts/helpers.ps1.erb index 50f99be3..392ba47c 100644 --- a/lib/mixlib/install/generator/powershell/scripts/helpers.ps1.erb +++ b/lib/mixlib/install/generator/powershell/scripts/helpers.ps1.erb @@ -67,7 +67,7 @@ function Get-WebContentOnFullNet { $proxy = New-Object -TypeName System.Net.WebProxy $wc = new-object System.Net.WebClient $wc.Headers.Add("user-agent", "<%= user_agent_string %>") - $proxy.Address = $env:http_proxy + $proxy.Address = $http_proxy $wc.Proxy = $proxy if ([string]::IsNullOrEmpty($filepath)) { diff --git a/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 b/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 index 66b73ba5..0ff551b1 100644 --- a/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 +++ b/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 @@ -50,9 +50,6 @@ function Install-Project { $http_proxy ) - # Set http_proxy as env var - $env:http_proxy = $http_proxy - $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture if (-not [string]::IsNullOrEmpty($filename)) {