Skip to content

Commit

Permalink
Merge pull request #130 from newrelic/chore/new-relic-region
Browse files Browse the repository at this point in the history
Support multiple newrelic regions
  • Loading branch information
Julien4218 authored Jan 8, 2021
2 parents cc8d088 + 464c732 commit 4e8a352
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
9 changes: 7 additions & 2 deletions recipes/newrelic/infra-agent/amazonlinux2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ install:
setup_license:
cmds:
- |
if [ ! -f /etc/newrelic-infra.yml ]; then
sudo touch /etc/newrelic-infra.yml;
if [ -f /etc/newrelic-infra.yml ]; then
sudo rm /etc/newrelic-infra.yml;
fi
sudo touch /etc/newrelic-infra.yml;
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NEW_RELIC_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
- |
if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
echo 'staging: true' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
fi
install_infra:
cmds:
Expand Down
9 changes: 7 additions & 2 deletions recipes/newrelic/infra-agent/centos_rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ install:
setup_license:
cmds:
- |
if [ ! -f /etc/newrelic-infra.yml ]; then
sudo touch /etc/newrelic-infra.yml;
if [ -f /etc/newrelic-infra.yml ]; then
sudo rm /etc/newrelic-infra.yml;
fi
sudo touch /etc/newrelic-infra.yml;
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NEW_RELIC_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
- |
if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
echo 'staging: true' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
fi
install_infra:
cmds:
Expand Down
4 changes: 4 additions & 0 deletions recipes/newrelic/infra-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ install:
sudo touch /etc/newrelic-infra.yml;
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NEW_RELIC_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
- |
if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
echo 'staging: true' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
fi
install_infra:
cmds:
Expand Down
4 changes: 4 additions & 0 deletions recipes/newrelic/infra-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ install:
sudo touch /etc/newrelic-infra.yml;
- |
echo -e "license_key: {{.NEW_RELIC_LICENSE_KEY}}" | sudo tee -a /etc/newrelic-infra.yml > /dev/null
- |
if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
echo 'staging: true' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
fi
install_infra:
cmds:
Expand Down
4 changes: 4 additions & 0 deletions recipes/newrelic/infra-agent/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ install:
sudo touch /etc/newrelic-infra.yml;
- |
echo -e "license_key: {{.NEW_RELIC_LICENSE_KEY}}" | sudo tee -a /etc/newrelic-infra.yml > /dev/null
- |
if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
echo 'staging: true' | sudo tee -a /etc/newrelic-infra.yml > /dev/null
fi
install_infra:
cmds:
Expand Down
1 change: 1 addition & 0 deletions recipes/newrelic/infra-agent/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ install:
- powershell -command '$LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"; msiexec.exe /qn /i "$env:TEMP\newrelic-infra.msi" GENERATE_CONFIG=true LICENSE_KEY="$LICENSE_KEY" | Out-Null;'
- powershell -command '(New-Object System.Net.WebClient).DownloadFile("https://aka.ms/vs/16/release/vc_redist.x64.exe", "$env:TEMP\vc_redist.x64.exe");'
- powershell -command 'start-process -FilePath "$env:TEMP\vc_redist.x64.exe" -ArgumentList "/install /q /norestart" -Verb RunAs -wait | Out-Null;'
- powershell -command '$NEW_RELIC_REGION="{{.NEW_RELIC_REGION}}"; if ($NEW_RELIC_REGION -ilike "staging") { Add-Content -Path "C:\\Program Files\\New Relic\\newrelic-infra\\newrelic-infra.yml" -Value "staging`:` true" -Force; };'
- powershell -command '$logs = "C:\\Program Files\\New Relic\\newrelic-infra\\logging.d\\logs.yml"; if (Test-Path $logs) { Remove-Item $logs }'
- powershell -command 'echo "{{.LOGS_CONTENT}}" >> "C:\\Program Files\\New Relic\\newrelic-infra\\logging.d\\logs.yml"'
- powershell -command 'net start newrelic-infra'
Expand Down

0 comments on commit 4e8a352

Please sign in to comment.