From 637a785b838af2cfe12c9251ae81de38685bf51d Mon Sep 17 00:00:00 2001 From: Ryan Thorn Date: Mon, 13 Mar 2023 17:08:42 -0700 Subject: [PATCH] chore: Add proxy support for ubuntu & debian infra --- .../newrelic/infrastructure/centos_rhel.yml | 8 +++++++ recipes/newrelic/infrastructure/debian.yml | 24 +++++++++++++++---- recipes/newrelic/infrastructure/ubuntu.yml | 18 +++++++++++--- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/recipes/newrelic/infrastructure/centos_rhel.yml b/recipes/newrelic/infrastructure/centos_rhel.yml index b8e001217..07c6e7953 100644 --- a/recipes/newrelic/infrastructure/centos_rhel.yml +++ b/recipes/newrelic/infrastructure/centos_rhel.yml @@ -160,6 +160,14 @@ install: if [ ! -z "$HTTPS_PROXY" ]; then sed -i "/^proxy/d" /etc/newrelic-infra.yml echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml + + if ! grep -q '^proxy=' /etc/dnf/dnf.conf; then + echo "************************************************************" + echo "WARNING: proxy settings not detected in your dnf config" + echo "If installation fails with a timeout, add the following line to /etc/dnf/dnf.conf and retry:" + echo "proxy={{.HTTPS_PROXY}}" + echo "************************************************************" + fi fi install_infra: diff --git a/recipes/newrelic/infrastructure/debian.yml b/recipes/newrelic/infrastructure/debian.yml index 53ac34b0a..080bf73d9 100644 --- a/recipes/newrelic/infrastructure/debian.yml +++ b/recipes/newrelic/infrastructure/debian.yml @@ -200,7 +200,11 @@ install: cmds: - | # Get latest definitions and skip any failure because of deprecation - apt-get -o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false update -yq + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq silent: true # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. ignore_error: true @@ -209,7 +213,11 @@ install: cmds: - | if [ {{.HAS_GPG}} -eq 0 ] ; then - apt-get -o DPkg::Lock::Timeout=60 install gnupg2 -y + OPTIONS="-o DPkg::Lock::Timeout=60" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS install gnupg2 -y fi vars: HAS_GPG: @@ -245,14 +253,22 @@ install: cmds: - | # Get latest definitions and skip any failure because of deprecation - apt-get -o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false update -yq + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. ignore_error: true install_infra: cmds: - | - apt-get -o DPkg::Lock::Timeout=60 install newrelic-infra -y -qq + OPTIONS="-o DPkg::Lock::Timeout=60" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS install newrelic-infra -y -qq silent: true restart: diff --git a/recipes/newrelic/infrastructure/ubuntu.yml b/recipes/newrelic/infrastructure/ubuntu.yml index e37d44420..eb897d9fb 100644 --- a/recipes/newrelic/infrastructure/ubuntu.yml +++ b/recipes/newrelic/infrastructure/ubuntu.yml @@ -186,7 +186,11 @@ install: cmds: - | # Get latest definitions and skip any failure because of deprecation - apt-get -o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false update -yq + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq silent: true # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. ignore_error: true @@ -225,14 +229,22 @@ install: cmds: - | # Get latest definitions and skip any failure because of deprecation - apt-get -o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false update -yq + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. ignore_error: true install_infra: cmds: - | - apt-get -o DPkg::Lock::Timeout=60 install newrelic-infra -y -qq + OPTIONS="-o DPkg::Lock::Timeout=60" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS install newrelic-infra -y -qq silent: true restart: