Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop updates #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inherit_from: .rubocop_todo.yml

AlignParameters:
Enabled: false

Expand Down
17 changes: 17 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-04-20 15:39:52 -0500 using RuboCop version 0.49.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 7
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 51

# Offense count: 1
Security/MarshalLoad:
Exclude:
- 'libraries/cache_data.rb'
2 changes: 2 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://supermarket.chef.io'

metadata
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'

group :integration do
# Workaround: berkshell is dependent on buff-extensions gem but install older version as the new one (2.0.0) requires
# ruby 2.2 and chefdk up to 0.17 provides ruby 2.1.8
gem 'buff-extensions', '~>1.0.0'
gem 'berkshelf'
gem 'buff-extensions', '~>1.0.0'
gem 'kitchen-docker', '>=2.3.0'
gem 'kitchen-vagrant', '>=0.18.0'
gem 'test-kitchen', '>=1.4.2'
Expand Down
2 changes: 2 additions & 0 deletions attributes/agents_package.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: agents_package
Expand Down
2 changes: 2 additions & 0 deletions attributes/apache_wsagent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: apache_wsagent
Expand Down
2 changes: 2 additions & 0 deletions attributes/collector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: collector
Expand Down
2 changes: 2 additions & 0 deletions attributes/copy_or_download_file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: copy_or_download_file
Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: default
Expand Down
2 changes: 2 additions & 0 deletions attributes/dotnet_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: dotnet_agent
Expand Down
2 changes: 2 additions & 0 deletions attributes/host_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: host_agent
Expand Down
2 changes: 2 additions & 0 deletions attributes/iis_wsagent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: iis_wsagent
Expand Down
2 changes: 2 additions & 0 deletions attributes/java.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: java
Expand Down
2 changes: 2 additions & 0 deletions attributes/java_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: java_agent
Expand Down
2 changes: 2 additions & 0 deletions attributes/memory_analysis_server.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: memory_analysis_server
Expand Down
2 changes: 2 additions & 0 deletions attributes/one_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# The Dynatrace One Agent package will be installed into the directory
# node['dynatrace']['agents_package']['linux']['installer']['prefix_dir']/dynatrace-$major-$minor-$rev,
# where $major, $minor and $rev are given by the installer. A symbolic link to the actual installation directory will
Expand Down
4 changes: 3 additions & 1 deletion attributes/server.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: server
Expand Down Expand Up @@ -50,7 +52,7 @@
default['dynatrace']['server']['pwh_connection']['password'] = 'dynatrace'

# Accepted HTTP return codes when setting PWH connection. Used mainly for integration tests
default['dynatrace']['server']['pwh_connection']['success_codes'] = %w(200)
default['dynatrace']['server']['pwh_connection']['success_codes'] = %w[200]

# Set a longer boot timeout due to the time to open the collector port
# (see log "[SelfMonitoringLauncher] Waiting for self-monitoring Collector startup (max: 90 seconds)")
Expand Down
2 changes: 2 additions & 0 deletions attributes/server_update.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: server_update
Expand Down
2 changes: 2 additions & 0 deletions attributes/upgrade_system.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: upgrade_system
# Attributes:: upgrade system
Expand Down
2 changes: 2 additions & 0 deletions attributes/wsagent_package.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Attributes:: wsagent_package
Expand Down
2 changes: 2 additions & 0 deletions libraries/cache_data.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: cache_data
Expand Down
12 changes: 7 additions & 5 deletions libraries/endpoint_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: endpoint_helpers
Expand All @@ -19,9 +21,9 @@ class DynatraceTimeout < Timeout::Error; end
# Exception used to inform that a connection endpoint (listening port, REST WS) is still not available
class DynatraceNotReady < StandardError
def initialize(endpoint, timeout)
super <<-EOH
The Dynatrace Server at `#{endpoint}' did not become ready within #{timeout} seconds.
Possibly, Dynatrace has failed to start. Please check your Dynatrace Server log files.
super <<~EOH
The Dynatrace Server at `#{endpoint}' did not become ready within #{timeout} seconds.
Possibly, Dynatrace has failed to start. Please check your Dynatrace Server log files.
EOH
end
end
Expand Down Expand Up @@ -90,7 +92,7 @@ def self.wait_until_rest_endpoint_is_ready!(endpoint, timeout = 180)

def self.rest_get(endpoint, user, pass, options = {})
options[:accept] = options.fetch(:accept, 'application/json')
options[:success_codes] = options.fetch(:success_codes, %w(200))
options[:success_codes] = options.fetch(:success_codes, %w[200])

uri = URI(endpoint)
http = Net::HTTP.new(uri.host, uri.port)
Expand All @@ -106,7 +108,7 @@ def self.rest_get(endpoint, user, pass, options = {})

def self.rest_put(endpoint, user, pass, body, options = {})
options[:accept] = options.fetch(:accept, 'application/json')
options[:success_codes] = options.fetch(:success_codes, %w(200))
options[:success_codes] = options.fetch(:success_codes, %w[200])

uri = URI(endpoint)
http = Net::HTTP.new(uri.host, uri.port)
Expand Down
2 changes: 2 additions & 0 deletions libraries/file_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: file_helpers
Expand Down
2 changes: 2 additions & 0 deletions libraries/package_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: package_helpers
Expand Down
4 changes: 3 additions & 1 deletion libraries/process_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: process_helpers
Expand Down Expand Up @@ -53,7 +55,7 @@ def self.stop_processes(proc_pattern, proc_user, platform_family, timeout = 15,
# private_class_method
def self.find_pids(pattern, user, platform_family)
pids = []
raise 'ERROR: Unsupported platform' unless %w(debian fedora rhel).include? platform_family
raise 'ERROR: Unsupported platform' unless %w[debian fedora rhel].include? platform_family

pgrep_pattern_opt = !pattern.nil? ? "-f \"#{pattern}\"" : ''
pgrep_user_opt = !user.nil? ? "-u #{user}" : ''
Expand Down
2 changes: 2 additions & 0 deletions libraries/s3_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Libraries:: s3_helpers
Expand Down
4 changes: 3 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

name 'dynatrace-appmon'
maintainer 'Martin Etmajer'
maintainer_email 'martin.etmajer@dynatrace.com'
Expand All @@ -9,7 +11,7 @@
issues_url 'https://github.com/Dynatrace/Dynatrace-AppMon-Chef/issues'
chef_version '>= 12.1'

%w( debian ubuntu redhat centos fedora amazon windows ).each do |os|
%w[debian ubuntu redhat centos fedora amazon windows].each do |os|
supports os
end

Expand Down
2 changes: 2 additions & 0 deletions providers/configure_ini_files.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: configure_ini_files
Expand Down
2 changes: 2 additions & 0 deletions providers/configure_init_scripts.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: configure_init_scripts
Expand Down
2 changes: 2 additions & 0 deletions providers/copy_or_download_file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: copy_or_download_file
Expand Down
2 changes: 2 additions & 0 deletions providers/delete_directory_by_link.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: delete_directory_by_link
Expand Down
2 changes: 2 additions & 0 deletions providers/run_jar_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: run_jar_installer
Expand Down
2 changes: 2 additions & 0 deletions providers/run_tar_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Providers:: run_tar_installer
Expand Down
2 changes: 2 additions & 0 deletions recipes/agents_package.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: agents_package
Expand Down
2 changes: 2 additions & 0 deletions recipes/agents_package_uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: agents_package_uninstall
Expand Down
2 changes: 2 additions & 0 deletions recipes/apache_wsagent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: apache_wsagent
Expand Down
2 changes: 2 additions & 0 deletions recipes/apache_wsagent_uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: apache_wsagent_uninstall
Expand Down
4 changes: 3 additions & 1 deletion recipes/collector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: collector
Expand Down Expand Up @@ -103,7 +105,7 @@
service_name service
# For Debian and Ubuntu distros - to correctly stop our service we need the status support which is disabled by default
supports :status => true
action [:start, :enable]
action %i[start enable]
end

ruby_block "Waiting for port #{agent_port} to become available" do
Expand Down
2 changes: 2 additions & 0 deletions recipes/collector_uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: collector_uninstall
Expand Down
2 changes: 2 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: default
Expand Down
2 changes: 2 additions & 0 deletions recipes/dotnet_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: dotnet_agent
Expand Down
2 changes: 2 additions & 0 deletions recipes/dynatrace_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: dynatrace_user
Expand Down
2 changes: 2 additions & 0 deletions recipes/dynatrace_user_uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: dynatrace_user_uninstall
Expand Down
4 changes: 3 additions & 1 deletion recipes/host_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: host_agent
Expand Down Expand Up @@ -115,5 +117,5 @@
service_name service_name
# For Debian and Ubuntu distros - to correctly stop our service we need the status support which is disabled by default
supports :status => true
action [:enable, :start]
action %i[enable start]
end
2 changes: 2 additions & 0 deletions recipes/host_agent_uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: host_agent_uninstall
Expand Down
2 changes: 2 additions & 0 deletions recipes/iis_wsagent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: iis_wsagent
Expand Down
2 changes: 2 additions & 0 deletions recipes/java.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: java
Expand Down
2 changes: 2 additions & 0 deletions recipes/java_agent.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: java_agent
Expand Down
4 changes: 3 additions & 1 deletion recipes/memory_analysis_server.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Cookbook Name:: dynatrace
# Recipes:: memory_analysis_server
Expand Down Expand Up @@ -95,7 +97,7 @@
service_name service
# For Debian and Ubuntu distros - to correctly stop our service we need the status support which is disabled by default
supports :status => true
action [:start, :enable]
action %i[start enable]
end

ruby_block "Waiting for port #{server_port} to become available" do
Expand Down