Skip to content

Commit

Permalink
chore: updates to match latest CLI spec (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Trombley <[email protected]>
  • Loading branch information
jbeveland27 and ctrombley authored Dec 9, 2020
1 parent e0c0c72 commit 12d6027
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ All recipes can either run in interactive mode where users are prompted for conf

The `newrelic-cli` injects at runtime of a go-task the following variables:

* `{{.NR_LICENSE_KEY}}` populated by the key associated with the profile run with the CLI
* `{{.NEW_RELIC_LICENSE_KEY}}` populated by the key associated with the profile run with the CLI
* Input Variables - recipes can use `inputVars` to prompt the user to enter variables needed in the recipe.

```bash
Expand Down Expand Up @@ -119,7 +119,7 @@ setup_license:
fi
- |
# Check for a license_key in the file and update it if it exists; otherwise, write a license_key into the file
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NR_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NR_LICENSE_KEY}}' | sudo tee -a /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
```

Another approach might be:
Expand All @@ -139,7 +139,7 @@ setup_license:
sudo touch /etc/newrelic-infra.yml;
- |
# write the license_key into the newrelic-infra.yml config
echo -e "license_key: {{.NR_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
echo -e "license_key: {{.NEW_RELIC_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
```

### Installing latest version of a given Agent/OHI should happen automatically
Expand Down
4 changes: 2 additions & 2 deletions docs/recipe-spec/recipe-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ install: string, required

# DO NOT USE: License Key is automatically injected by the newrelic-cli
# env:
# NR_LICENSE_KEY: '{{.NR_LICENSE_KEY}}'
# NEW_RELIC_LICENSE_KEY: '{{.NEW_RELIC_LICENSE_KEY}}'

variables:
- FOO_VAR: foo-value
Expand All @@ -113,7 +113,7 @@ install: string, required
install_infra:
cmds:
- echo "Installing the Infrastructure agent"
- curl -L https://raw.githubusercontent.com/fryckbos/infra-install/master/install.sh {{.NR_LICENSE_KEY}} | sh
- curl -L https://raw.githubusercontent.com/fryckbos/infra-install/master/install.sh {{.NEW_RELIC_LICENSE_KEY}} | sh
silent: true

```
Expand Down
2 changes: 1 addition & 1 deletion docs/recipe-spec/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"secret": false,
"default": "/var/log/messages,/var/log/cloud-init.log,/var/log/secure"
}],
"validationNrql": "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago",
"validationNrql": "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago",
"preInstall": {
"prompt": "Message about things user should know"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-linux-infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ install:
install_infra:
cmds:
- echo "Installing the Infrastructure agent"
- curl -L https://raw.githubusercontent.com/fryckbos/infra-install/master/install.sh {{.NR_LICENSE_KEY}} | sh
- curl -L https://raw.githubusercontent.com/fryckbos/infra-install/master/install.sh {{.NEW_RELIC_LICENSE_KEY}} | sh
silent: true
4 changes: 2 additions & 2 deletions recipes/newrelic/infra-agent/amazonlinux2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ keywords:
processMatch:
- /infra/

validationNrql: "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

# go-task yaml definition goes here
# This spec - https://github.com/go-task/task
Expand All @@ -40,7 +40,7 @@ install:
sudo touch /etc/newrelic-infra.yml;
fi
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NR_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NR_LICENSE_KEY}}' | sudo tee -a /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
install_infra:
cmds:
Expand Down
4 changes: 2 additions & 2 deletions recipes/newrelic/infra-agent/centos_rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ keywords:
processMatch:
- /infra/

validationNrql: "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

# go-task yaml definition goes here
# This spec - https://github.com/go-task/task
Expand All @@ -54,7 +54,7 @@ install:
sudo touch /etc/newrelic-infra.yml;
fi
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NR_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NR_LICENSE_KEY}}' | sudo tee -a /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
install_infra:
cmds:
Expand Down
4 changes: 2 additions & 2 deletions recipes/newrelic/infra-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ keywords:
processMatch:
- /infra/

validationNrql: "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

# go-task yaml definition goes here
# This spec - https://github.com/go-task/task
Expand All @@ -43,7 +43,7 @@ install:
fi
sudo touch /etc/newrelic-infra.yml;
- |
grep -q '^license_key' /etc/newrelic-infra.yml && sudo sed -i 's/^license_key.*/license_key: {{.NR_LICENSE_KEY}}/' /etc/newrelic-infra.yml || echo 'license_key: {{.NR_LICENSE_KEY}}' | sudo tee -a /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
install_infra:
cmds:
Expand Down
4 changes: 2 additions & 2 deletions recipes/newrelic/infra-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ keywords:
processMatch:
- /infra/

validationNrql: "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

# go-task yaml definition goes here
# This spec - https://github.com/go-task/task
Expand All @@ -41,7 +41,7 @@ install:
fi
sudo touch /etc/newrelic-infra.yml;
- |
echo -e "license_key: {{.NR_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
echo -e "license_key: {{.NEW_RELIC_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
install_infra:
cmds:
Expand Down
4 changes: 2 additions & 2 deletions recipes/newrelic/infra-agent/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ keywords:
processMatch:
- /infra/

validationNrql: "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

# go-task yaml definition goes here
# This spec - https://github.com/go-task/task
Expand All @@ -45,7 +45,7 @@ install:
fi
sudo touch /etc/newrelic-infra.yml;
- |
echo -e "license_key: {{.NR_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
echo -e "license_key: {{.NEW_RELIC_LICENSE_KEY}}" >> /etc/newrelic-infra.yml
install_infra:
cmds:
Expand Down
2 changes: 1 addition & 1 deletion recipes/newrelic/nginx/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ logMatch:
attributes:
logtype: nginx-error

validationNrql: "SELECT count(*) from NginxSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from NginxSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

install:
version: "3"
Expand Down
2 changes: 1 addition & 1 deletion recipes/newrelic/nginx/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ logMatch:
attributes:
logtype: nginx-error

validationNrql: "SELECT count(*) from NginxSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from NginxSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

install:
version: "3"
Expand Down
2 changes: 1 addition & 1 deletion recipes/newrelic/nginx/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ logMatch:
attributes:
logtype: nginx-error

validationNrql: "SELECT count(*) from NginxSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
validationNrql: "SELECT count(*) from NginxSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"

install:
version: "3"
Expand Down
6 changes: 3 additions & 3 deletions recipes/newrelic/node-agent/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ install:
echo "Enter a name for your application and press [ENTER]:"
read appname
echo ""
if [ -z "{{.NR_LICENSE_KEY}}" ]; then
if [ -z "{{.NEW_RELIC_LICENSE_KEY}}" ]; then
echo "Please provide a license key and press [ENTER]:"
read NR_LICENSE_KEY
read NEW_RELIC_LICENSE_KEY
echo ""
fi
echo "Writing the newrelic.js configuration file."
Expand All @@ -66,7 +66,7 @@ install:
/**
* Your New Relic license key.
*/
license_key: '{{.NR_LICENSE_KEY}}',
license_key: '{{.NEW_RELIC_LICENSE_KEY}}',
/**
* This setting controls distributed tracing.
* Distributed tracing lets you see the path that a request takes through your
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set_fact:
nrql_query: "{{ nrql_query | regex_replace(item.finder, item.replacer) }}"
with_items:
- { finder: '(.*)(HOSTNAME)(.*)', replacer: "'\\1{{hostname_output.stdout}}\\3'" }
- { finder: '(.*)(\{\{\.HOSTNAME\}\})(.*)', replacer: "'\\1{{hostname_output.stdout}}\\3'" }
- name: trim eventual quotes
set_fact:
nrql_query: "{{ nrql_query | regex_replace(item.finder, item.replacer) }}"
Expand Down
4 changes: 2 additions & 2 deletions validator/schema-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"default": "/var/log/messages,/var/log/cloud-init.log,/var/log/secure"
}
],
"validationNrql": "SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago",
"validationNrql": "SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago",
"preInstall": {
"prompt": "Message about things user should know"
},
Expand Down Expand Up @@ -482,7 +482,7 @@
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"SELECT count(*) from SystemSample where hostname like 'HOSTNAME' SINCE 10 minutes ago"
"SELECT count(*) from SystemSample where hostname like '{{.HOSTNAME}}' SINCE 10 minutes ago"
]
},
"preInstall": {
Expand Down

0 comments on commit 12d6027

Please sign in to comment.