diff --git a/Rakefile b/Rakefile index 02056cf6..f16ac163 100644 --- a/Rakefile +++ b/Rakefile @@ -247,23 +247,23 @@ namespace :publish do end desc 'Run lint checks' -task :lint => %w(style) +task :lint => %w[style] desc 'Run unit tests' -task :unit => %w(spec) +task :unit => %w[spec] desc 'Run Travis CI tests' -task :travis => %w(lint unit) +task :travis => %w[lint unit] desc 'Run all integration tests' -task :integration => %w(integration:vagrant) +task :integration => %w[integration:vagrant] desc 'Publish' -task :publish => %w(publish:scm publish:chef:supermarket publish:chef:server) +task :publish => %w[publish:scm publish:chef:supermarket publish:chef:server] desc 'Release' task :release do ReleaseCommands.release(environment) end -task :default => %w(lint unit integration) +task :default => %w[lint unit integration] diff --git a/metadata.rb b/metadata.rb index 937e401d..344ad554 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,7 @@ version '2.29.0' chef_version '>= 0.10.0' if respond_to?(:chef_version) -%w(debian ubuntu redhat centos fedora scientific amazon windows smartos oracle).each do |os| +%w[debian ubuntu redhat centos fedora scientific amazon windows smartos oracle].each do |os| supports os end diff --git a/providers/agent_php.rb b/providers/agent_php.rb index 5651eaf4..09e590a3 100644 --- a/providers/agent_php.rb +++ b/providers/agent_php.rb @@ -168,7 +168,7 @@ def startup_mode_config # ensure that the daemon isn't currently running # only stop the daemon if it has not been run by the agent (with a newrelic.cfg) service 'newrelic-daemon' do - action [:disable, :stop] # stops the service if it's running and disables it from starting at system boot time + action %i[disable stop] # stops the service if it's running and disables it from starting at system boot time only_if { ::File.exist?('/etc/newrelic/newrelic.cfg') } end # ensure that the file /etc/newrelic/newrelic.cfg does not exist if it does, move it aside (or remove it) @@ -198,7 +198,7 @@ def startup_mode_config notifies new_resource.service_action, "service[#{new_resource.service_name}]", :delayed if new_resource.service_name end service 'newrelic-daemon' do - action [:enable, :start] # starts the service if it's not running and enables it to start at system boot time + action %i[enable start] # starts the service if it's not running and enables it to start at system boot time end else raise "#{new_resource.startup_mode} is not a valid newrelic-daemon startup mode." diff --git a/providers/deployment.rb b/providers/deployment.rb index 7d1cb11f..f3aeeb27 100644 --- a/providers/deployment.rb +++ b/providers/deployment.rb @@ -5,7 +5,7 @@ # Copyright (c) 2016, David Joos # -use_inline_resources if defined?(use_inline_resources) +use_inline_resources def whyrun_supported? true @@ -67,8 +67,6 @@ def whyrun_supported? command command_curl action :run end - - new_resource.updated_by_last_action(true) end end diff --git a/providers/yml.rb b/providers/yml.rb index 74822b9c..4387d1a6 100644 --- a/providers/yml.rb +++ b/providers/yml.rb @@ -7,7 +7,7 @@ require 'uri' -use_inline_resources if defined?(use_inline_resources) +use_inline_resources def whyrun_supported? true @@ -40,6 +40,4 @@ def whyrun_supported? sensitive true action :create end - - new_resource.updated_by_last_action(t.updated_by_last_action?) end diff --git a/resources/agent_infrastructure.rb b/resources/agent_infrastructure.rb index 3fb0980d..6aea4915 100644 --- a/resources/agent_infrastructure.rb +++ b/resources/agent_infrastructure.rb @@ -17,6 +17,6 @@ attribute :proxy, :kind_of => String, :default => nil attribute :template_cookbook, :kind_of => String, :default => 'newrelic' attribute :template_source, :kind_of => String, :default => 'agent/infrastructure/newrelic.yml.erb' -attribute :service_actions, :kind_of => Array, :default => %w(enable start) +attribute :service_actions, :kind_of => Array, :default => %w[enable start] attribute :windows_version, :kind_of => String, :default => '1.0.703' attribute :windows_checksum, :kind_of => String, :default => '3c9f98325dc484ee8735f01b913803eaef54f06641348b3dd9f3c0b3cd803ace' diff --git a/resources/deployment.rb b/resources/deployment.rb index 28fdd2a8..e027a43a 100644 --- a/resources/deployment.rb +++ b/resources/deployment.rb @@ -9,7 +9,7 @@ default_action :notify attribute :url, :kind_of => String, :default => 'https://api.newrelic.com/deployments.xml' -attribute :key_type, :kind_of => String, :equal_to => %w(license_key api_key), :default => 'api_key' +attribute :key_type, :kind_of => String, :equal_to => %w[license_key api_key], :default => 'api_key' attribute :key, :name_attribute => true, :kind_of => String # @todo take out deprecated api_key logic @@ -24,7 +24,5 @@ def initialize(*args) super - @action = :notify - @run_context.include_recipe 'curl' end diff --git a/resources/server_monitor.rb b/resources/server_monitor.rb index b88d07f6..2c3d4920 100644 --- a/resources/server_monitor.rb +++ b/resources/server_monitor.rb @@ -26,7 +26,7 @@ attribute :config_file_user, :kind_of => String, :default => 'root' attribute :service_notify_action, :kind_of => String, :default => 'restart' -attribute :service_actions, :kind_of => Array, :default => %w(enable start) +attribute :service_actions, :kind_of => Array, :default => %w[enable start] attribute :windows_version, :kind_of => String, :default => '2.0.0.198' attribute :windows64_checksum, :kind_of => String, :default => '5a8f3f5e8f15997463430401756d377c321c8899c2790ca85e5587a5b643651e' attribute :windows32_checksum, :kind_of => String, :default => 'ac2b65eecaad461fdd2e4386e3e4c9f96ea940b35bdf7a8c532c21dbd1c99ff0' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 650ea012..080f0841 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -26,7 +26,7 @@ def stub_node_resources(node) RSpec.configure do |config| config.mock_with :rspec do |c| - c.syntax = [:should, :expect] + c.syntax = %i[should expect] end config.log_level = :error config.formatter = :documentation diff --git a/spec/unit/agent_java_spec.rb b/spec/unit/agent_java_spec.rb index f98b87aa..9c108ada 100644 --- a/spec/unit/agent_java_spec.rb +++ b/spec/unit/agent_java_spec.rb @@ -46,7 +46,7 @@ ChefSpec::Runner.new(:log_level => LOG_LEVEL, :platform => 'centos', :version => '6.6', :step_into => ['newrelic_agent_java']) do |node| stub_node_resources(node) node.override['newrelic']['java_agent']['class_transformer_config'] = { - 'classloader_blacklist' => %w(class1 class2), + 'classloader_blacklist' => %w[class1 class2], 'instrumentation_classes' => { 'wildfly-8' => { 'enabled' => false }, 'wildfly-8-CAT' => { 'enabled' => false }, diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/metadata.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/metadata.rb index 9176b78c..9670fd29 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/metadata.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/metadata.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 name 'newrelic_lwrp_test' maintainer 'David Joos' maintainer_email 'development@davidjoos.com' diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_dotnet.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_dotnet.rb index 1005c8cd..29bf3880 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_dotnet.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_dotnet.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_dotnet diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_infrastructure.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_infrastructure.rb index 1dc2fd46..837cc519 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_infrastructure.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_infrastructure.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_infrastructure diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_java.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_java.rb index 74448de9..cfbd9907 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_java.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_java.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_java diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs.rb index e51147bd..04f0f0c3 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_nodejs diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs_recipe.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs_recipe.rb index 7ce2f64a..2559fcf2 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs_recipe.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_nodejs_recipe.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_nodejs_recipe diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_php.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_php.rb index 4c06efb1..08d94c3f 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_php.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_php.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_php diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python.rb index 7166fcea..6eae6a5f 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_python diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python_recipe.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python_recipe.rb index ee37060e..f852508b 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python_recipe.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_python_recipe.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_python_recipe diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_ruby.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_ruby.rb index b85e8b0b..3dacb7fb 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_ruby.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_ruby.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: agent_java diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/lwrp_yml.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/lwrp_yml.rb index c896b36f..f34869af 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/lwrp_yml.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/lwrp_yml.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: lwrp_yml diff --git a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/server_monitor.rb b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/server_monitor.rb index 721c395d..1bbe3c6b 100644 --- a/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/server_monitor.rb +++ b/test/fixtures/cookbooks/newrelic_lwrp_test/recipes/server_monitor.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # # Cookbook Name:: newrelic_lwrp_test # Recipe:: server_monitor diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index 0ad71dc5..ef9c36da 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -6,7 +6,7 @@ it { is_expected.to be_enabled } end - describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do + describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end diff --git a/test/integration/infrastructure-agent/serverspec/default_spec.rb b/test/integration/infrastructure-agent/serverspec/default_spec.rb index 222b55d0..a60b32c1 100644 --- a/test/integration/infrastructure-agent/serverspec/default_spec.rb +++ b/test/integration/infrastructure-agent/serverspec/default_spec.rb @@ -4,7 +4,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic-infra.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic-infra.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end describe package 'newrelic-infra' do diff --git a/test/integration/nodejs-agent-recipe/serverspec/default_spec.rb b/test/integration/nodejs-agent-recipe/serverspec/default_spec.rb index 2a2da5b8..7297a9c4 100644 --- a/test/integration/nodejs-agent-recipe/serverspec/default_spec.rb +++ b/test/integration/nodejs-agent-recipe/serverspec/default_spec.rb @@ -5,7 +5,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end diff --git a/test/integration/nodejs-agent/serverspec/default_spec.rb b/test/integration/nodejs-agent/serverspec/default_spec.rb index 9b24bae7..004bc457 100644 --- a/test/integration/nodejs-agent/serverspec/default_spec.rb +++ b/test/integration/nodejs-agent/serverspec/default_spec.rb @@ -4,7 +4,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end diff --git a/test/integration/php-agent-php5enmod/serverspec/default_spec.rb b/test/integration/php-agent-php5enmod/serverspec/default_spec.rb index 8de9c010..c5b05eeb 100644 --- a/test/integration/php-agent-php5enmod/serverspec/default_spec.rb +++ b/test/integration/php-agent-php5enmod/serverspec/default_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe file('/etc/php5/conf.d/newrelic.ini'), :if => %w(12.04).include?(os[:release]) do +describe file('/etc/php5/conf.d/newrelic.ini'), :if => %w[12.04].include?(os[:release]) do it { is_expected.to be_file } end -describe file('/etc/php5/mods-available/newrelic.ini'), :if => %w(14.04).include?(os[:release]) do +describe file('/etc/php5/mods-available/newrelic.ini'), :if => %w[14.04].include?(os[:release]) do it { is_expected.to be_file } end diff --git a/test/integration/php-agent/serverspec/default_spec.rb b/test/integration/php-agent/serverspec/default_spec.rb index 5a2836c4..ab80cc34 100644 --- a/test/integration/php-agent/serverspec/default_spec.rb +++ b/test/integration/php-agent/serverspec/default_spec.rb @@ -4,7 +4,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end describe package 'newrelic-daemon' do diff --git a/test/integration/python-agent-recipe/serverspec/default_spec.rb b/test/integration/python-agent-recipe/serverspec/default_spec.rb index 020d2c69..a914286a 100644 --- a/test/integration/python-agent-recipe/serverspec/default_spec.rb +++ b/test/integration/python-agent-recipe/serverspec/default_spec.rb @@ -5,7 +5,7 @@ it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end diff --git a/test/integration/python-agent/serverspec/default_spec.rb b/test/integration/python-agent/serverspec/default_spec.rb index 0bece596..0366276f 100644 --- a/test/integration/python-agent/serverspec/default_spec.rb +++ b/test/integration/python-agent/serverspec/default_spec.rb @@ -4,7 +4,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end diff --git a/test/integration/server-monitor/serverspec/default_spec.rb b/test/integration/server-monitor/serverspec/default_spec.rb index e9469441..d2707b8f 100644 --- a/test/integration/server-monitor/serverspec/default_spec.rb +++ b/test/integration/server-monitor/serverspec/default_spec.rb @@ -4,7 +4,7 @@ it { is_expected.to exist } it { is_expected.to be_enabled } end -describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do +describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do it { is_expected.to be_file } end describe package 'newrelic-sysmond' do