From de1dec9fb7f4d84bb733f9052ee3b5ca9ba66d35 Mon Sep 17 00:00:00 2001 From: Ryan Thorn Date: Fri, 3 Mar 2023 10:58:20 -0800 Subject: [PATCH] feat: Add proxy support for windows recipes --- recipes/newrelic/apm/dotNet/windows-iis.yml | 7 ++++++- recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml | 6 +++++- recipes/newrelic/infrastructure/windows.yml | 7 ++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/recipes/newrelic/apm/dotNet/windows-iis.yml b/recipes/newrelic/apm/dotNet/windows-iis.yml index 2434cd4ad..83e8b0ef1 100644 --- a/recipes/newrelic/apm/dotNet/windows-iis.yml +++ b/recipes/newrelic/apm/dotNet/windows-iis.yml @@ -200,8 +200,13 @@ install: } catch {} + $WebClient = New-Object System.Net.WebClient + if ($env:HTTPS_PROXY) { + $WebClient.Proxy = New-Object System.Net.WebProxy($env:HTTPS_PROXY, $true) + } + try { - (New-Object System.Net.WebClient).DownloadFile("{{.NEW_RELIC_DOWNLOAD_URL}}dot_net_agent/latest_release/NewRelicDotNetAgent_x64.msi", "$env:TEMP\NewRelicDotNetAgent_x64.msi") + $WebClient.DownloadFile("{{.NEW_RELIC_DOWNLOAD_URL}}dot_net_agent/latest_release/NewRelicDotNetAgent_x64.msi", "$env:TEMP\NewRelicDotNetAgent_x64.msi") } catch { $baseException = $_.Exception.GetBaseException() diff --git a/recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml b/recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml index 6f28583a8..a3d708a7e 100644 --- a/recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml +++ b/recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml @@ -383,7 +383,11 @@ install: } # Installing MSSql Integration - (New-Object System.Net.WebClient).DownloadFile("http://download.newrelic.com/infrastructure_agent/windows/integrations/nri-mssql/nri-mssql-amd64.msi", "$env:TEMP\nri-mssql-amd64.msi"); + $WebClient = New-Object System.Net.WebClient + if ($env:HTTPS_PROXY) { + $WebClient.Proxy = New-Object System.Net.WebProxy($env:HTTPS_PROXY, $true) + } + $WebClient.DownloadFile("http://download.newrelic.com/infrastructure_agent/windows/integrations/nri-mssql/nri-mssql-amd64.msi", "$env:TEMP\nri-mssql-amd64.msi"); msiexec.exe /qn /i "$env:TEMP\nri-mssql-amd64.msi" | Out-Null; Restart-Service newrelic-infra diff --git a/recipes/newrelic/infrastructure/windows.yml b/recipes/newrelic/infrastructure/windows.yml index 97585fc3c..1967a4dcd 100644 --- a/recipes/newrelic/infrastructure/windows.yml +++ b/recipes/newrelic/infrastructure/windows.yml @@ -146,8 +146,13 @@ install: } catch {} + $WebClient = New-Object System.Net.WebClient + if ($env:HTTPS_PROXY) { + $WebClient.Proxy = New-Object System.Net.WebProxy($env:HTTPS_PROXY, $true) + } + try { - (New-Object System.Net.WebClient).DownloadFile("{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/windows/newrelic-infra.msi", "$env:TEMP\newrelic-infra.msi") + $WebClient.DownloadFile("{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/windows/newrelic-infra.msi", "$env:TEMP\newrelic-infra.msi") } catch { $baseException = $_.Exception.GetBaseException()