Skip to content

Commit

Permalink
chore: Add proxy support for ubuntu & debian infra
Browse files Browse the repository at this point in the history
  • Loading branch information
rthorn-nr committed Mar 16, 2023
1 parent 0744781 commit 637a785
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
8 changes: 8 additions & 0 deletions recipes/newrelic/infrastructure/centos_rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 20 additions & 4 deletions recipes/newrelic/infrastructure/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 15 additions & 3 deletions recipes/newrelic/infrastructure/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 637a785

Please sign in to comment.