Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ChNorman authored Dec 31, 2018
2 parents e69eed2 + 233ebd5 commit d545486
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
addons:
apt:
sources:
- chef-stable-precise
- chef-stable-trusty # Ubuntu 14.04 LTS Trusty Tahr
packages:
- chefdk

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This file is used to list changes made in each version (>= 2.11.0) of the newrelic cookbook.

## v2.39.1
- Fix distributed tracing issues

## v2.39.0
- add distributed_tracing attribute for Java and Ruby APM

Expand Down
4 changes: 3 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
license 'MIT'
description 'Installs/Configures New Relic'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.39.0'

version '2.39.1'

chef_version '>= 0.10.0' if respond_to?(:chef_version)

%w[debian ubuntu redhat centos fedora scientific amazon windows smartos oracle].each do |os|
Expand Down
6 changes: 5 additions & 1 deletion providers/agent_infrastructure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ def linux_service_provider
# upstart workaround(s)
case node['platform_family']
when 'amazon'
if node['platform_version'].to_i == 1
# Amazon 1.x version format is 'YEAR.MONTH'
if node['platform_version'].to_i > 2000
service_provider = Chef::Provider::Service::Upstart
end
when 'rhel'
if node['platform_version'] =~ /^6/
service_provider = Chef::Provider::Service::Upstart
end
end

case node['platform']
when 'ubuntu'
if node['platform_version'].to_f < 16.04
service_provider = Chef::Provider::Service::Upstart
Expand Down
1 change: 1 addition & 0 deletions recipes/java_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
daemon_proxy_port node['newrelic']['application_monitoring']['daemon']['proxy_port'] unless node['newrelic']['application_monitoring']['daemon']['proxy_port'].nil?
daemon_proxy_user node['newrelic']['application_monitoring']['daemon']['proxy_user'] unless node['newrelic']['application_monitoring']['daemon']['proxy_user'].nil?
daemon_proxy_password node['newrelic']['application_monitoring']['daemon']['proxy_password'] unless node['newrelic']['application_monitoring']['daemon']['proxy_password'].nil?
distributed_tracing_enable node['newrelic']['java_agent']['distributed_tracing_enable'] unless node['newrelic']['java_agent']['distributed_tracing_enable'].nil?
capture_params node['newrelic']['application_monitoring']['capture_params'] unless node['newrelic']['application_monitoring']['capture_params'].nil?
ignored_params node['newrelic']['application_monitoring']['ignored_params'] unless node['newrelic']['application_monitoring']['ignored_params'].nil?
transaction_tracer_enable node['newrelic']['application_monitoring']['transaction_tracer']['enable'] unless node['newrelic']['application_monitoring']['transaction_tracer']['enable'].nil?
Expand Down
1 change: 1 addition & 0 deletions recipes/ruby_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
log_daily node['newrelic']['ruby_agent']['log_daily'] unless node['newrelic']['ruby_agent']['log_daily']
daemon_ssl NewRelic.to_boolean(node['newrelic']['application_monitoring']['daemon']['ssl']) unless node['newrelic']['application_monitoring']['daemon']['ssl']
daemon_proxy node['newrelic']['application_monitoring']['daemon']['proxy'] unless node['newrelic']['application_monitoring']['daemon']['proxy']
distributed_tracing_enable node['newrelic']['ruby_agent']['distributed_tracing_enable'] unless node['newrelic']['ruby_agent']['distributed_tracing_enable'].nil?
capture_params node['newrelic']['application_monitoring']['capture_params'] unless node['newrelic']['application_monitoring']['capture_params']
ignored_params node['newrelic']['application_monitoring']['ignored_params'] unless node['newrelic']['application_monitoring']['ignored_params']
transaction_tracer_enable node['newrelic']['application_monitoring']['transaction_tracer']['enable'] unless node['newrelic']['application_monitoring']['transaction_tracer']['enable']
Expand Down
1 change: 1 addition & 0 deletions resources/yml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
attribute :daemon_proxy_port, :kind_of => String, :default => nil
attribute :daemon_proxy_user, :kind_of => String, :default => nil
attribute :daemon_proxy_password, :kind_of => String, :default => nil
attribute :distributed_tracing_enable, :kind_of => [TrueClass, FalseClass], :default => false
attribute :capture_params, :default => node['newrelic']['application_monitoring']['capture_params']
attribute :ignored_params, :default => node['newrelic']['application_monitoring']['ignored_params']
attribute :enable_custom_tracing, :kind_of => [TrueClass, FalseClass], :default => false
Expand Down
60 changes: 59 additions & 1 deletion spec/unit/agent_infrastructure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,65 @@
end

it 'enables newrelic-infra service' do
expect(chef_run).to enable_service('newrelic-infra')
expect(chef_run).to enable_service('newrelic-infra').with(
:provider => Chef::Provider::Service::Upstart
)
end
end

context 'Ubuntu 14.04' do
let(:chef_run) do
ChefSpec::SoloRunner.new(:log_level => LOG_LEVEL, :platform => 'ubuntu', :version => '14.04', :step_into => ['newrelic_agent_infrastructure']) do |node|
stub_node_resources(node)
end.converge(described_recipe)
end

it 'enables newrelic-infra service with upstart' do
expect(chef_run).to enable_service('newrelic-infra').with(
:provider => Chef::Provider::Service::Upstart
)
end
end

context 'Ubuntu 16.04' do
let(:chef_run) do
ChefSpec::SoloRunner.new(:log_level => LOG_LEVEL, :platform => 'ubuntu', :version => '16.04', :step_into => ['newrelic_agent_infrastructure']) do |node|
stub_node_resources(node)
end.converge(described_recipe)
end

it 'enables newrelic-infra service with systemd' do
expect(chef_run).to enable_service('newrelic-infra').with(
:provider => Chef::Provider::Service::Systemd
)
end
end

context 'Amazon Linux' do
let(:chef_run) do
ChefSpec::SoloRunner.new(:log_level => LOG_LEVEL, :platform => 'amazon', :version => '2018.03', :step_into => ['newrelic_agent_infrastructure']) do |node|
stub_node_resources(node)
end.converge(described_recipe)
end

it 'enables newrelic-infra service with upstart' do
expect(chef_run).to enable_service('newrelic-infra').with(
:provider => Chef::Provider::Service::Upstart
)
end
end

context 'Amazon Linux 2' do
let(:chef_run) do
ChefSpec::SoloRunner.new(:log_level => LOG_LEVEL, :platform => 'amazon', :version => '2', :step_into => ['newrelic_agent_infrastructure']) do |node|
stub_node_resources(node)
end.converge(described_recipe)
end

it 'enables newrelic-infra service with systemd' do
expect(chef_run).to enable_service('newrelic-infra').with(
:provider => Chef::Provider::Service::Systemd
)
end
end
end

0 comments on commit d545486

Please sign in to comment.