From 921aa0a8cebf81a6c5e4ead8e516061302fc37a3 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 19:55:55 +0100 Subject: [PATCH 01/35] Fix incorrect variable names in `forwarder.pp` Update variables to match parameters. Not just a lint error, an actual bug! Signed-off-by: Alexander Fisher --- manifests/forwarder.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index a5f7351f..ff038de9 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -113,10 +113,10 @@ Splunk_config['splunk'] { purge_forwarder_outputs => $purge_outputs, - purge_forwarder_inputs => $purge_forwarder_inputs, - purge_forwarder_props => $purge_forwarder_props, - purge_forwarder_transforms => $purge_forwarder_transforms, - purge_forwarder_web => $purge_forwarder_web + purge_forwarder_inputs => $purge_inputs, + purge_forwarder_props => $purge_props, + purge_forwarder_transforms => $purge_transforms, + purge_forwarder_web => $purge_web, } # This is a module that supports multiple platforms. For some platforms From 913e62dead86a0cdf71a411d5e60b386b1e143a8 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 19:58:52 +0100 Subject: [PATCH 02/35] Fix `::include` bug `::include splunk::platform::solaris` had the `::`s in the wrong place. Signed-off-by: Alexander Fisher --- manifests/forwarder.pp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index ff038de9..4d658228 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -123,9 +123,13 @@ # there is non-generic configuration that needs to be declared in addition # to the agnostic resources declared here. case $::kernel { - 'Linux': { class { '::splunk::platform::posix': splunkd_port => $splunkd_port, - splunk_user => $splunk_user } } - 'SunOS': { ::include splunk::platform::solaris } + 'Linux': { + class { '::splunk::platform::posix': + splunkd_port => $splunkd_port, + splunk_user => $splunk_user, + } + } + 'SunOS': { include ::splunk::platform::solaris } default: { } # no special configuration needed } From 105bd2398c6c0d9c38a0a43663bfb07ebd3ec456 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 20:00:36 +0100 Subject: [PATCH 03/35] Fix remaining lint errors These were just lint errors as opposed to actual bugs. Signed-off-by: Alexander Fisher --- manifests/addon.pp | 4 +-- manifests/forwarder.pp | 20 ++++++------ manifests/init.pp | 70 +++++++++++++++++++++--------------------- manifests/params.pp | 16 +++++----- manifests/password.pp | 25 +++++++-------- 5 files changed, 68 insertions(+), 67 deletions(-) diff --git a/manifests/addon.pp b/manifests/addon.pp index ad494a16..ac092f02 100644 --- a/manifests/addon.pp +++ b/manifests/addon.pp @@ -55,10 +55,10 @@ if $inputs { concat { "splunk::addon::inputs_${name}": path => "${splunk_home}/etc/apps/${name}/local/inputs.conf", - require => File["${splunk_home}/etc/apps/${name}/local"] + require => File["${splunk_home}/etc/apps/${name}/local"], } - create_resources('splunk::addon::input', $inputs, {"addon" => $name }) + create_resources('splunk::addon::input', $inputs, {'addon' => $name }) } } diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index 4d658228..694c034b 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -105,7 +105,7 @@ section => 'settings', setting => 'mgmtHostPort', value => "${splunkd_listen}:${splunkd_port}", - tag => 'splunk_forwarder' + tag => 'splunk_forwarder', } # If the purge parameters have been set, remove all unmanaged entries from @@ -156,19 +156,19 @@ mode => '0644', } - file { "/opt/splunkforwarder/etc/system/local/inputs.conf": - ensure => present, - tag => 'splunk_forwarder' + file { '/opt/splunkforwarder/etc/system/local/inputs.conf': + ensure => file, + tag => 'splunk_forwarder', } - file { "/opt/splunkforwarder/etc/system/local/outputs.conf": - ensure => present, - tag => 'splunk_forwarder' + file { '/opt/splunkforwarder/etc/system/local/outputs.conf': + ensure => file, + tag => 'splunk_forwarder', } - file { "/opt/splunkforwarder/etc/system/local/web.conf": - ensure => present, - tag => 'splunk_forwarder' + file { '/opt/splunkforwarder/etc/system/local/web.conf': + ensure => file, + tag => 'splunk_forwarder', } # Validate: if both Splunk and Splunk Universal Forwarder are installed on diff --git a/manifests/init.pp b/manifests/init.pp index e41226c2..68d32494 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -109,14 +109,14 @@ section => 'settings', setting => 'mgmtHostPort', value => "${splunkd_listen}:${splunkd_port}", - tag => 'splunk_server' + tag => 'splunk_server', } splunk_web { 'splunk_server_web_port': section => 'settings', setting => 'httpport', value => $web_port, - tag => 'splunk_server' + tag => 'splunk_server', } @@ -217,59 +217,59 @@ mode => '0600', } - file { "/opt/splunk/etc/system/local/authentication.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/authentication.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/authorize.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/authorize.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/distsearch.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/distsearch.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/indexes.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/indexes.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/inputs.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/inputs.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/limits.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/limits.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/outputs.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/outputs.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/props.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/props.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/server.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/server.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/transforms.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/transforms.conf': + ensure => file, + tag => 'splunk_server', } - file { "/opt/splunk/etc/system/local/web.conf": - ensure => present, - tag => 'splunk_server' + file { '/opt/splunk/etc/system/local/web.conf': + ensure => file, + tag => 'splunk_server', } # Validate: if both Splunk and Splunk Universal Forwarder are installed on diff --git a/manifests/params.pp b/manifests/params.pp index 5650b735..e783456f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -155,26 +155,26 @@ # default splunk agent settings in a hash so that the cya be easily parsed to other classes $forwarder_output = { - "tcpout_defaultgroup" => { + 'tcpout_defaultgroup' => { section => 'default', setting => 'defaultGroup', value => "${server}_${logging_port}", - tag => 'splunk_forwarder' + tag => 'splunk_forwarder', }, - "defaultgroup_server" => { + 'defaultgroup_server' => { section => "tcpout:${server}_${logging_port}", setting => 'server', value => "${server}:${logging_port}", - tag => 'splunk_forwarder' - } + tag => 'splunk_forwarder', + }, } $forwarder_input = { 'default_host' => { section => 'default', setting => 'host', - value => "$::clientcert", - tag => 'splunk_forwarder' - } + value => $::clientcert, + tag => 'splunk_forwarder', + }, } # Settings common to an OS family case $::osfamily { diff --git a/manifests/password.pp b/manifests/password.pp index 2f67991f..dee7beba 100644 --- a/manifests/password.pp +++ b/manifests/password.pp @@ -26,28 +26,29 @@ # which service we should expect the licesnse to be accepted for # # sponsored by balgroup -class splunk::password( $password_config_file = $splunk::params::password_config_file, - $secret_file = $splunk::params::secret_file, - $secret = $splunk::params::secret, - $password_content = $splunk::params::password_content, - $service_password = 'splunk_forwarder', - $virtual_service = $splunk::params::forwarder_service, - $license = 'license_splunkforwarder', - $package_name = $splunk::params::forwarder_pkg_name, - ) inherits splunk::params { +class splunk::password( + $password_config_file = $splunk::params::password_config_file, + $secret_file = $splunk::params::secret_file, + $secret = $splunk::params::secret, + $password_content = $splunk::params::password_content, + $service_password = 'splunk_forwarder', + $virtual_service = $splunk::params::forwarder_service, + $license = 'license_splunkforwarder', + $package_name = $splunk::params::forwarder_pkg_name, +) inherits splunk::params { if ! defined(Class['splunk::forwarder']) and ! defined(Class['splunk']){ fail('You must include the splunk forwarder or splunk class before changing the password defined resources') } - file { "$password_config_file": + file { $password_config_file: ensure => file, content => $password_content, require => Package[$package_name], notify => Service[$virtual_service], - tag => "splunk_password", + tag => 'splunk_password', } - file { "$secret_file": + file { $secret_file: ensure => file, content => $secret, require => Package[$package_name], From 290fb3d70a33248ec1cf9df6e21380ae3254c5f1 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 20:02:35 +0100 Subject: [PATCH 04/35] `Fix` tests * Add `fixtures.yml`. * Add `default_module_facts.yml` with `staging_http_get` fact. * Rubocop fixes in `spec/classes/example_spec.rb`. * Remove completely broken tests. Looks like there aren't really any tests and `spec/classes/example_spec.rb` is just boilerplate/skeleton. For instance there is no `config.pp` manifest, so ```ruby it { is_expected.to contain_class('splunk::config') } ``` was never going to pass! Signed-off-by: Alexander Fisher --- .fixtures.yml | 7 +++++++ spec/classes/example_spec.rb | 15 +++++++-------- spec/default_module_facts.yml | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .fixtures.yml create mode 100644 spec/default_module_facts.yml diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..609f4ea5 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,7 @@ +fixtures: + repositories: + stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' + inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git' + staging: 'https://github.com/voxpupuli/puppet-staging.git' + symlinks: + splunk: "#{source_dir}" diff --git a/spec/classes/example_spec.rb b/spec/classes/example_spec.rb index 01faae05..ba1b46ca 100644 --- a/spec/classes/example_spec.rb +++ b/spec/classes/example_spec.rb @@ -8,16 +8,13 @@ facts end - context "splunk class without any parameters" do + context 'splunk class without any parameters' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('splunk::params') } - it { is_expected.to contain_class('splunk::install').that_comes_before('splunk::config') } - it { is_expected.to contain_class('splunk::config') } - it { is_expected.to contain_class('splunk::service').that_subscribes_to('splunk::config') } it { is_expected.to contain_service('splunk') } - it { is_expected.to contain_package('splunk').with_ensure('present') } + it { is_expected.to contain_package('splunk').with_ensure('installed') } end end end @@ -27,12 +24,14 @@ describe 'splunk class without any parameters on Solaris/Nexenta' do let(:facts) do { - :osfamily => 'Solaris', - :operatingsystem => 'Nexenta', + osfamily: 'Solaris', + operatingsystem: 'Nexenta', + kernel: 'SunOS', + architecture: 'sparc' } end - it { expect { is_expected.to contain_package('splunk') }.to raise_error(Puppet::Error, /Nexenta not supported/) } + it { expect { is_expected.to contain_package('splunk') }.to raise_error(Puppet::Error, %r{unsupported osfamily/arch Solaris/sparc}) } end end end diff --git a/spec/default_module_facts.yml b/spec/default_module_facts.yml new file mode 100644 index 00000000..0b9b7d9a --- /dev/null +++ b/spec/default_module_facts.yml @@ -0,0 +1,2 @@ +--- +staging_http_get: 'curl' From ec1d4484f5a7c4c94665020c834a74e12e597ce2 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 20:08:30 +0100 Subject: [PATCH 05/35] Rename spec file Signed-off-by: Alexander Fisher --- spec/classes/{example_spec.rb => splunk_spec.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec/classes/{example_spec.rb => splunk_spec.rb} (100%) diff --git a/spec/classes/example_spec.rb b/spec/classes/splunk_spec.rb similarity index 100% rename from spec/classes/example_spec.rb rename to spec/classes/splunk_spec.rb From da5d1123a0e896b4bebeea6858bfec658f23f4de Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 20:09:07 +0100 Subject: [PATCH 06/35] Rename `README.markdown` to `README.md` For consistency with other Vox Pupuli maintained modules. Signed-off-by: Alexander Fisher --- README.markdown => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.markdown => README.md (100%) diff --git a/README.markdown b/README.md similarity index 100% rename from README.markdown rename to README.md From 71a3c8ce643506b5e47bd97551d62a4076ac4925 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:30:08 +0200 Subject: [PATCH 07/35] rubocop: fix Style/HashSyntax --- lib/puppet/provider/ini_setting/splunk.rb | 4 ++-- .../provider/splunk_authentication/ini_setting.rb | 2 +- lib/puppet/provider/splunk_authorize/ini_setting.rb | 2 +- lib/puppet/provider/splunk_distsearch/ini_setting.rb | 2 +- lib/puppet/provider/splunk_indexes/ini_setting.rb | 2 +- lib/puppet/provider/splunk_input/ini_setting.rb | 2 +- lib/puppet/provider/splunk_limits/ini_setting.rb | 2 +- lib/puppet/provider/splunk_output/ini_setting.rb | 2 +- lib/puppet/provider/splunk_props/ini_setting.rb | 2 +- lib/puppet/provider/splunk_server/ini_setting.rb | 2 +- lib/puppet/provider/splunk_transforms/ini_setting.rb | 2 +- lib/puppet/provider/splunk_web/ini_setting.rb | 2 +- .../provider/splunkforwarder_input/ini_setting.rb | 2 +- .../provider/splunkforwarder_output/ini_setting.rb | 2 +- .../provider/splunkforwarder_props/ini_setting.rb | 2 +- .../provider/splunkforwarder_transforms/ini_setting.rb | 2 +- lib/puppet/provider/splunkforwarder_web/ini_setting.rb | 2 +- lib/puppet/type/splunk_config.rb | 10 +++++----- spec/acceptance/splunk_forwarder_spec.rb | 4 ++-- spec/acceptance/splunk_spec.rb | 4 ++-- spec/spec_helper_acceptance.rb | 8 ++++---- spec/spec_helper_system.rb | 2 +- 22 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index 72f9d3d9..573d618e 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -1,9 +1,9 @@ Puppet::Type.type(:ini_setting).provide( :splunk, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + parent: Puppet::Type.type(:ini_setting).provider(:ruby) ) do - confine :true => false # Never automatically select this provider + confine true: false # Never automatically select this provider @file_path = nil diff --git a/lib/puppet/provider/splunk_authentication/ini_setting.rb b/lib/puppet/provider/splunk_authentication/ini_setting.rb index c87f3ff3..36c223a9 100644 --- a/lib/puppet/provider/splunk_authentication/ini_setting.rb +++ b/lib/puppet/provider/splunk_authentication/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_authentication).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/authentication.conf' diff --git a/lib/puppet/provider/splunk_authorize/ini_setting.rb b/lib/puppet/provider/splunk_authorize/ini_setting.rb index 66a5a486..e66a904c 100644 --- a/lib/puppet/provider/splunk_authorize/ini_setting.rb +++ b/lib/puppet/provider/splunk_authorize/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_authorize).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/authorize.conf' diff --git a/lib/puppet/provider/splunk_distsearch/ini_setting.rb b/lib/puppet/provider/splunk_distsearch/ini_setting.rb index 7ed0f875..1a00f9fa 100644 --- a/lib/puppet/provider/splunk_distsearch/ini_setting.rb +++ b/lib/puppet/provider/splunk_distsearch/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_distsearch).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/distsearch.conf' diff --git a/lib/puppet/provider/splunk_indexes/ini_setting.rb b/lib/puppet/provider/splunk_indexes/ini_setting.rb index 0a3dde7c..a914b079 100644 --- a/lib/puppet/provider/splunk_indexes/ini_setting.rb +++ b/lib/puppet/provider/splunk_indexes/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_indexes).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/indexes.conf' diff --git a/lib/puppet/provider/splunk_input/ini_setting.rb b/lib/puppet/provider/splunk_input/ini_setting.rb index 7c773413..314544b6 100644 --- a/lib/puppet/provider/splunk_input/ini_setting.rb +++ b/lib/puppet/provider/splunk_input/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_input).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/inputs.conf' diff --git a/lib/puppet/provider/splunk_limits/ini_setting.rb b/lib/puppet/provider/splunk_limits/ini_setting.rb index 5efe3790..7455882c 100644 --- a/lib/puppet/provider/splunk_limits/ini_setting.rb +++ b/lib/puppet/provider/splunk_limits/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_limits).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/limits.conf' diff --git a/lib/puppet/provider/splunk_output/ini_setting.rb b/lib/puppet/provider/splunk_output/ini_setting.rb index 30509261..b268400c 100644 --- a/lib/puppet/provider/splunk_output/ini_setting.rb +++ b/lib/puppet/provider/splunk_output/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_output).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/outputs.conf' diff --git a/lib/puppet/provider/splunk_props/ini_setting.rb b/lib/puppet/provider/splunk_props/ini_setting.rb index 0cad9f57..17cc3d6e 100644 --- a/lib/puppet/provider/splunk_props/ini_setting.rb +++ b/lib/puppet/provider/splunk_props/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_props).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/props.conf' diff --git a/lib/puppet/provider/splunk_server/ini_setting.rb b/lib/puppet/provider/splunk_server/ini_setting.rb index 93c1a6cf..19eb0dec 100644 --- a/lib/puppet/provider/splunk_server/ini_setting.rb +++ b/lib/puppet/provider/splunk_server/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_server).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/server.conf' diff --git a/lib/puppet/provider/splunk_transforms/ini_setting.rb b/lib/puppet/provider/splunk_transforms/ini_setting.rb index 1665d8a8..f61b2ec0 100644 --- a/lib/puppet/provider/splunk_transforms/ini_setting.rb +++ b/lib/puppet/provider/splunk_transforms/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_transforms).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/transforms.conf' diff --git a/lib/puppet/provider/splunk_web/ini_setting.rb b/lib/puppet/provider/splunk_web/ini_setting.rb index 86b1fbf7..d663faa5 100644 --- a/lib/puppet/provider/splunk_web/ini_setting.rb +++ b/lib/puppet/provider/splunk_web/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunk_web).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/web.conf' diff --git a/lib/puppet/provider/splunkforwarder_input/ini_setting.rb b/lib/puppet/provider/splunkforwarder_input/ini_setting.rb index 93299e85..a2a3a31a 100644 --- a/lib/puppet/provider/splunkforwarder_input/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_input/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunkforwarder_input).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/inputs.conf' diff --git a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb index 80c88369..b61d997d 100644 --- a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunkforwarder_output).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name "system/local/outputs.conf" diff --git a/lib/puppet/provider/splunkforwarder_props/ini_setting.rb b/lib/puppet/provider/splunkforwarder_props/ini_setting.rb index e1d3d19d..df9e1344 100644 --- a/lib/puppet/provider/splunkforwarder_props/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_props/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunkforwarder_props).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/props.conf' diff --git a/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb b/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb index 45841ec2..49683173 100644 --- a/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunkforwarder_transforms).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/transforms.conf' diff --git a/lib/puppet/provider/splunkforwarder_web/ini_setting.rb b/lib/puppet/provider/splunkforwarder_web/ini_setting.rb index 4c239007..ad943497 100644 --- a/lib/puppet/provider/splunkforwarder_web/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_web/ini_setting.rb @@ -1,6 +1,6 @@ Puppet::Type.type(:splunkforwarder_web).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:splunk) + parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name 'system/local/web.conf' diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 654cb4c5..b844e006 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -6,7 +6,7 @@ end Puppet::Type.newtype(:splunk_config) do - newparam(:name, :namevar => true) do + newparam(:name, namevar: true) do desc 'splunk config' end @@ -126,10 +126,10 @@ def purge_splunk_resources(klass) Puppet::Type.type(type_name).instances.each do |instance| unless puppet_resources.include?(instance.name) purge_resources << Puppet::Type.type(type_name).new( - :name => instance.name, - :section => instance[:section], - :setting => instance[:setting], - :ensure => :absent + name: instance.name, + section: instance[:section], + setting: instance[:setting], + ensure: :absent ) end end diff --git a/spec/acceptance/splunk_forwarder_spec.rb b/spec/acceptance/splunk_forwarder_spec.rb index 57001e2f..1ffa9e3b 100644 --- a/spec/acceptance/splunk_forwarder_spec.rb +++ b/spec/acceptance/splunk_forwarder_spec.rb @@ -9,8 +9,8 @@ class { '::splunk::forwarder': } EOS # Run it twice and test for idempotency - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end describe package('splunkforwarder') do diff --git a/spec/acceptance/splunk_spec.rb b/spec/acceptance/splunk_spec.rb index f0f055a2..d5d5a249 100644 --- a/spec/acceptance/splunk_spec.rb +++ b/spec/acceptance/splunk_spec.rb @@ -9,8 +9,8 @@ class { '::splunk': } EOS # Run it twice and test for idempotency - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end describe package('splunk') do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index adca7bf1..e91b61e7 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -15,11 +15,11 @@ c.before :suite do # Install module and dependencies # Need to stage the Splunk/Splunkforwarder packages here. - puppet_module_install(:source => proj_root, :module_name => 'splunk') + puppet_module_install(source: proj_root, module_name: 'splunk') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module', 'install', 'nanliu-staging'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module', 'install', 'puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module', 'install', 'puppetlabs-stdlib'), { acceptable_exit_codes: [0,1] } + on host, puppet('module', 'install', 'nanliu-staging'), { acceptable_exit_codes: [0,1] } + on host, puppet('module', 'install', 'puppetlabs-inifile'), { acceptable_exit_codes: [0,1] } end end end diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb index ce97663f..02360cbb 100644 --- a/spec/spec_helper_system.rb +++ b/spec/spec_helper_system.rb @@ -18,7 +18,7 @@ puppet_install # Install modules and dependencies - puppet_module_install(:source => proj_root, :module_name => 'splunk') + puppet_module_install(source: proj_root, module_name: 'splunk') shell('puppet module install nanliu-staging --version 0.3.1') shell('puppet module install puppetlabs-stdlib --version 3.0.0') shell('puppet module install puppetlabs-inifile --version 1.0.0') From 246b660714f15fc5b77bf756a13ced373a0ab199 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:30:29 +0200 Subject: [PATCH 08/35] rubocop: fix Style/StringLiterals --- lib/puppet/provider/ini_setting/splunk.rb | 4 ++-- lib/puppet/provider/splunkforwarder_output/ini_setting.rb | 2 +- lib/puppet/type/splunk_authentication.rb | 2 +- lib/puppet/type/splunk_authorize.rb | 2 +- lib/puppet/type/splunk_config.rb | 2 +- lib/puppet/type/splunk_distsearch.rb | 2 +- lib/puppet/type/splunk_indexes.rb | 2 +- lib/puppet/type/splunk_input.rb | 2 +- lib/puppet/type/splunk_limits.rb | 2 +- lib/puppet/type/splunk_output.rb | 2 +- lib/puppet/type/splunk_props.rb | 2 +- lib/puppet/type/splunk_server.rb | 2 +- lib/puppet/type/splunk_transforms.rb | 2 +- lib/puppet/type/splunk_web.rb | 2 +- lib/puppet/type/splunkforwarder_input.rb | 2 +- lib/puppet/type/splunkforwarder_output.rb | 2 +- lib/puppet/type/splunkforwarder_props.rb | 2 +- lib/puppet/type/splunkforwarder_transforms.rb | 2 +- lib/puppet/type/splunkforwarder_web.rb | 2 +- 19 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index 573d618e..760f93ec 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -8,8 +8,8 @@ @file_path = nil def self.file_path - raise Puppet::Error, "file_path must be set with splunk_config type before provider can be used" if @file_path.nil? - raise Puppet::Error, "Child provider class does not support a file_name method" unless self.respond_to?(:file_name) + raise Puppet::Error, 'file_path must be set with splunk_config type before provider can be used' if @file_path.nil? + raise Puppet::Error, 'Child provider class does not support a file_name method' unless self.respond_to?(:file_name) File.join(@file_path, file_name) end diff --git a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb index b61d997d..29de0686 100644 --- a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb @@ -3,7 +3,7 @@ parent: Puppet::Type.type(:ini_setting).provider(:splunk) ) do def self.file_name - "system/local/outputs.conf" + 'system/local/outputs.conf' end end diff --git a/lib/puppet/type/splunk_authentication.rb b/lib/puppet/type/splunk_authentication.rb index 0dc13ac8..a466189d 100644 --- a/lib/puppet/type/splunk_authentication.rb +++ b/lib/puppet/type/splunk_authentication.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_authentication) do - @doc = "Manage splunk authentication settings in authentication.conf" + @doc = 'Manage splunk authentication settings in authentication.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_authorize.rb b/lib/puppet/type/splunk_authorize.rb index 85528f8e..c2c2c2c2 100644 --- a/lib/puppet/type/splunk_authorize.rb +++ b/lib/puppet/type/splunk_authorize.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_authorize) do - @doc = "Manage splunk authorize settings in authorize.conf" + @doc = 'Manage splunk authorize settings in authorize.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index b844e006..7c19f402 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -116,7 +116,7 @@ def purge_splunk_resources(klass) # catalog_resources = catalog.resources.select { |r| r.is_a?(klass) } catalog_resources.each do |res| - puppet_resources << res[:section] + "/" + res[:setting] + puppet_resources << res[:section] + '/' + res[:setting] end diff --git a/lib/puppet/type/splunk_distsearch.rb b/lib/puppet/type/splunk_distsearch.rb index 080a435b..92be2f8c 100644 --- a/lib/puppet/type/splunk_distsearch.rb +++ b/lib/puppet/type/splunk_distsearch.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_distsearch) do - @doc= "Manage distsearch entries in distsearch.conf" + @doc= 'Manage distsearch entries in distsearch.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_indexes.rb b/lib/puppet/type/splunk_indexes.rb index 976fb9c9..0ac5f701 100644 --- a/lib/puppet/type/splunk_indexes.rb +++ b/lib/puppet/type/splunk_indexes.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_indexes) do - @doc = "Manage splunk index settings in indexes.conf" + @doc = 'Manage splunk index settings in indexes.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_input.rb b/lib/puppet/type/splunk_input.rb index 3e275120..5c2f1861 100644 --- a/lib/puppet/type/splunk_input.rb +++ b/lib/puppet/type/splunk_input.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_input) do - @doc = "Manage splunk input settings in inputs.conf" + @doc = 'Manage splunk input settings in inputs.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_limits.rb b/lib/puppet/type/splunk_limits.rb index 748bfeda..29fb7c69 100644 --- a/lib/puppet/type/splunk_limits.rb +++ b/lib/puppet/type/splunk_limits.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_limits) do - @doc = "Manage splunk limits settings in limits.conf" + @doc = 'Manage splunk limits settings in limits.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_output.rb b/lib/puppet/type/splunk_output.rb index 13b84871..ab2b9658 100644 --- a/lib/puppet/type/splunk_output.rb +++ b/lib/puppet/type/splunk_output.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_output) do - @doc = "Manage splunk output settings in outputs.conf" + @doc = 'Manage splunk output settings in outputs.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_props.rb b/lib/puppet/type/splunk_props.rb index 94275c44..db1ce094 100644 --- a/lib/puppet/type/splunk_props.rb +++ b/lib/puppet/type/splunk_props.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_props) do - @doc = "Manage splunk prop settings in props.conf" + @doc = 'Manage splunk prop settings in props.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_server.rb b/lib/puppet/type/splunk_server.rb index 9df38bf7..ece5b5c1 100644 --- a/lib/puppet/type/splunk_server.rb +++ b/lib/puppet/type/splunk_server.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_server) do - @doc = "Manage splunk server settings in server.conf" + @doc = 'Manage splunk server settings in server.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_transforms.rb b/lib/puppet/type/splunk_transforms.rb index 31562338..6a1f01a8 100644 --- a/lib/puppet/type/splunk_transforms.rb +++ b/lib/puppet/type/splunk_transforms.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_transforms) do - @doc = "Manage splunk transforms settings in transforms.conf" + @doc = 'Manage splunk transforms settings in transforms.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunk_web.rb b/lib/puppet/type/splunk_web.rb index 9c7ae84b..9d28a830 100644 --- a/lib/puppet/type/splunk_web.rb +++ b/lib/puppet/type/splunk_web.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_web) do - @doc = "Manage splunk web settings in web.conf" + @doc = 'Manage splunk web settings in web.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunkforwarder_input.rb b/lib/puppet/type/splunkforwarder_input.rb index 7efe5150..2a6a1871 100644 --- a/lib/puppet/type/splunkforwarder_input.rb +++ b/lib/puppet/type/splunkforwarder_input.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunkforwarder_input) do - @doc = "Manage splunkforwarder input settings in inputs.conf" + @doc = 'Manage splunkforwarder input settings in inputs.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunkforwarder_output.rb b/lib/puppet/type/splunkforwarder_output.rb index 4fff0306..ed4e7f46 100644 --- a/lib/puppet/type/splunkforwarder_output.rb +++ b/lib/puppet/type/splunkforwarder_output.rb @@ -2,6 +2,6 @@ Puppet::Type.newtype(:splunkforwarder_output) do - @doc = "Manage splunkforwarder output settings in outputs.conf" + @doc = 'Manage splunkforwarder output settings in outputs.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunkforwarder_props.rb b/lib/puppet/type/splunkforwarder_props.rb index 20b485b6..60af3d23 100644 --- a/lib/puppet/type/splunkforwarder_props.rb +++ b/lib/puppet/type/splunkforwarder_props.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunkforwarder_props) do - @doc = "Manage splunkforwarder props settings in props.conf" + @doc = 'Manage splunkforwarder props settings in props.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunkforwarder_transforms.rb b/lib/puppet/type/splunkforwarder_transforms.rb index 10d7a612..9cd72aa7 100644 --- a/lib/puppet/type/splunkforwarder_transforms.rb +++ b/lib/puppet/type/splunkforwarder_transforms.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunkforwarder_transforms) do - @doc = "Manage splunkforwarder transforms settings in transforms.conf" + @doc = 'Manage splunkforwarder transforms settings in transforms.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end diff --git a/lib/puppet/type/splunkforwarder_web.rb b/lib/puppet/type/splunkforwarder_web.rb index 5215ee4b..3d713a5b 100644 --- a/lib/puppet/type/splunkforwarder_web.rb +++ b/lib/puppet/type/splunkforwarder_web.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunkforwarder_web) do - @doc = "Manage splunkforwarder web settings in web.conf" + @doc = 'Manage splunkforwarder web settings in web.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end From 680fe5037afa52f50983b4ee31b10392f6e13a66 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:30:43 +0200 Subject: [PATCH 09/35] rubocop: fix Style/BracesAroundHashParameters --- spec/spec_helper_acceptance.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index e91b61e7..fe975b77 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -17,9 +17,9 @@ # Need to stage the Splunk/Splunkforwarder packages here. puppet_module_install(source: proj_root, module_name: 'splunk') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), { acceptable_exit_codes: [0,1] } - on host, puppet('module', 'install', 'nanliu-staging'), { acceptable_exit_codes: [0,1] } - on host, puppet('module', 'install', 'puppetlabs-inifile'), { acceptable_exit_codes: [0,1] } + on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0,1] + on host, puppet('module', 'install', 'nanliu-staging'), acceptable_exit_codes: [0,1] + on host, puppet('module', 'install', 'puppetlabs-inifile'), acceptable_exit_codes: [0,1] end end end From 5b0c408631482ba6f2a5f5ae35bd57128922a922 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:31:00 +0200 Subject: [PATCH 10/35] rubocop: fix Style/SpaceAfterComma --- lib/puppet/type/splunk_config.rb | 4 ++-- spec/spec_helper_acceptance.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 7c19f402..b1ef3a42 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -42,7 +42,7 @@ :purge_forwarder_web ].each do |p| newparam(p) do - newvalues(:true,:false) + newvalues(:true, :false) defaultto :false end end @@ -71,7 +71,7 @@ def generate Puppet::Type::Splunkforwarder_props => self[:purge_forwarder_props], Puppet::Type::Splunkforwarder_transforms => self[:purge_forwarder_transforms], Puppet::Type::Splunkforwarder_web => self[:purge_forwarder_web] - }.each do |k,purge| + }.each do |k, purge| resources.concat(purge_splunk_resources(k)) if purge == :true end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index fe975b77..4f60a112 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -17,9 +17,9 @@ # Need to stage the Splunk/Splunkforwarder packages here. puppet_module_install(source: proj_root, module_name: 'splunk') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0,1] - on host, puppet('module', 'install', 'nanliu-staging'), acceptable_exit_codes: [0,1] - on host, puppet('module', 'install', 'puppetlabs-inifile'), acceptable_exit_codes: [0,1] + on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] + on host, puppet('module', 'install', 'nanliu-staging'), acceptable_exit_codes: [0, 1] + on host, puppet('module', 'install', 'puppetlabs-inifile'), acceptable_exit_codes: [0, 1] end end end From 459843c778d542722f250f381ae578f07564b479 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:31:13 +0200 Subject: [PATCH 11/35] rubocop: fix Style/IndentationWidth --- lib/puppet/type/splunk_config.rb | 6 +++--- lib/puppet_x/puppetlabs/splunk/type.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index b1ef3a42..c9c4a17f 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -1,8 +1,8 @@ # Require all of our types so the class names are resolvable for purging Dir[File.dirname(__FILE__) + '/*.rb'].each do |file| - unless file == __FILE__ - require file - end + unless file == __FILE__ + require file + end end Puppet::Type.newtype(:splunk_config) do diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index c8fc8993..7d90559e 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -25,7 +25,7 @@ def self.clone_type(type) end end type.newparam(:setting) do - desc 'The setting being defined.' + desc 'The setting being defined.' isnamevar munge do |v| v.to_s.strip From 79cc694c4cc6327eec7e3f2f1f5698b317a4679a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:31:26 +0200 Subject: [PATCH 12/35] rubocop: fix Style/EmptyLinesAroundBlockBody --- spec/system/forwarder_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/system/forwarder_spec.rb b/spec/system/forwarder_spec.rb index 8bc39288..f2d05ab3 100644 --- a/spec/system/forwarder_spec.rb +++ b/spec/system/forwarder_spec.rb @@ -2,7 +2,6 @@ require 'pry' describe 'setting up the forwarder' do - it 'should be able to set up a forwarder' do pp = <<-EOS class { 'splunk::params': From 5f570e517ebdc5193a0a69ece4488c7fa6d20b75 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:31:46 +0200 Subject: [PATCH 13/35] rubocop: fix Style/TrailingWhitespace --- lib/puppet/type/splunk_config.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index c9c4a17f..ea4a7750 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -1,5 +1,5 @@ # Require all of our types so the class names are resolvable for purging -Dir[File.dirname(__FILE__) + '/*.rb'].each do |file| +Dir[File.dirname(__FILE__) + '/*.rb'].each do |file| unless file == __FILE__ require file end @@ -23,7 +23,7 @@ end ## Generate purge parameters for the splunk_config type - [ + [ :purge_inputs, :purge_outputs, :purge_authentication, @@ -104,7 +104,7 @@ def set_provider_paths Puppet::Type.type(res_type).provider(:ini_setting).set_file_path(self[:forwarder_confdir]) end end - + def purge_splunk_resources(klass) type_name = klass.name purge_resources = Array.new @@ -136,5 +136,5 @@ def purge_splunk_resources(klass) return purge_resources end - + end From d653d763a328a71dc85a6c23db63eb6d9afb97bc Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:32:04 +0200 Subject: [PATCH 14/35] rubocop: fix Style/EmptyLines --- lib/puppet/type/splunk_config.rb | 2 -- lib/puppet/type/splunkforwarder_output.rb | 1 - 2 files changed, 3 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index ea4a7750..6e3f296d 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -78,7 +78,6 @@ def generate return resources end - def set_provider_paths [ :splunk_authentication, @@ -119,7 +118,6 @@ def purge_splunk_resources(klass) puppet_resources << res[:section] + '/' + res[:setting] end - # Search the configured instances of the class type and purge them if # the instance name (setion/setting) isn't found in puppet_resources # diff --git a/lib/puppet/type/splunkforwarder_output.rb b/lib/puppet/type/splunkforwarder_output.rb index ed4e7f46..66e31f70 100644 --- a/lib/puppet/type/splunkforwarder_output.rb +++ b/lib/puppet/type/splunkforwarder_output.rb @@ -1,6 +1,5 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') - Puppet::Type.newtype(:splunkforwarder_output) do @doc = 'Manage splunkforwarder output settings in outputs.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) From a6a53a3199c0bf6058fd3ca6977d0e4f943c614e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:32:15 +0200 Subject: [PATCH 15/35] rubocop: fix Style/TrailingBlankLines --- lib/puppet/provider/splunkforwarder_output/ini_setting.rb | 1 - lib/puppet/type/splunk_authentication.rb | 1 - lib/puppet/type/splunk_distsearch.rb | 1 - lib/puppet/type/splunk_indexes.rb | 1 - lib/puppet/type/splunkforwarder_web.rb | 1 - spec/acceptance/splunk_spec.rb | 1 - spec/spec_helper_system.rb | 1 - 7 files changed, 7 deletions(-) diff --git a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb index 29de0686..cf28d059 100644 --- a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb @@ -6,4 +6,3 @@ def self.file_name 'system/local/outputs.conf' end end - diff --git a/lib/puppet/type/splunk_authentication.rb b/lib/puppet/type/splunk_authentication.rb index a466189d..4b81ac00 100644 --- a/lib/puppet/type/splunk_authentication.rb +++ b/lib/puppet/type/splunk_authentication.rb @@ -4,4 +4,3 @@ @doc = 'Manage splunk authentication settings in authentication.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end - diff --git a/lib/puppet/type/splunk_distsearch.rb b/lib/puppet/type/splunk_distsearch.rb index 92be2f8c..5d75ea4a 100644 --- a/lib/puppet/type/splunk_distsearch.rb +++ b/lib/puppet/type/splunk_distsearch.rb @@ -4,4 +4,3 @@ @doc= 'Manage distsearch entries in distsearch.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end - diff --git a/lib/puppet/type/splunk_indexes.rb b/lib/puppet/type/splunk_indexes.rb index 0ac5f701..90607a68 100644 --- a/lib/puppet/type/splunk_indexes.rb +++ b/lib/puppet/type/splunk_indexes.rb @@ -4,4 +4,3 @@ @doc = 'Manage splunk index settings in indexes.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end - diff --git a/lib/puppet/type/splunkforwarder_web.rb b/lib/puppet/type/splunkforwarder_web.rb index 3d713a5b..e1632b11 100644 --- a/lib/puppet/type/splunkforwarder_web.rb +++ b/lib/puppet/type/splunkforwarder_web.rb @@ -4,4 +4,3 @@ @doc = 'Manage splunkforwarder web settings in web.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end - diff --git a/spec/acceptance/splunk_spec.rb b/spec/acceptance/splunk_spec.rb index d5d5a249..4ad22a92 100644 --- a/spec/acceptance/splunk_spec.rb +++ b/spec/acceptance/splunk_spec.rb @@ -23,4 +23,3 @@ class { '::splunk': } end end end - diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb index 02360cbb..fec2c383 100644 --- a/spec/spec_helper_system.rb +++ b/spec/spec_helper_system.rb @@ -24,4 +24,3 @@ shell('puppet module install puppetlabs-inifile --version 1.0.0') end end - From 357905b80509e90e2502ec0601b48b6742941009 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:32:31 +0200 Subject: [PATCH 16/35] rubocop: fix Style/SpaceInsideBrackets --- lib/puppet_x/puppetlabs/splunk/type.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 7d90559e..0b0d317d 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -8,12 +8,12 @@ def self.clone_type(type) type.define_singleton_method(:title_patterns) do [ - [ /^([^\/]*)$/, [ [ :section ] ] ], - [ /^(.*\/\/.*)$/, [ [ :section ] ] ], - [ /^(.*)\/(.*)$/, + [/^([^\/]*)$/, [[:section]]], + [/^(.*\/\/.*)$/, [[:section]]], + [/^(.*)\/(.*)$/, [ - [:section, lambda{|x| x} ], - [:setting, lambda{|x| x} ] + [:section, lambda{|x| x}], + [:setting, lambda{|x| x}] ] ] ] From 3c28a93fc3b2fa6b821a0d3826fa7cc3ea94dd8e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:32:51 +0200 Subject: [PATCH 17/35] rubocop: fix Style/EmptyLiteral --- lib/puppet/type/splunk_config.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 6e3f296d..d80ec0a0 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -53,7 +53,7 @@ def generate set_provider_paths - resources = Array.new + resources = [] { Puppet::Type::Splunk_output => self[:purge_outputs], @@ -106,8 +106,8 @@ def set_provider_paths def purge_splunk_resources(klass) type_name = klass.name - purge_resources = Array.new - puppet_resources = Array.new + purge_resources = [] + puppet_resources = [] # Search the catalog for resource types matching the provided class # type and build an array of puppet resources matching the namevar From 6d8fe0eb48ade7a7f8de65aebb4d39a36b8f677c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:33:09 +0200 Subject: [PATCH 18/35] rubocop: fix Style/IndentationConsistency --- lib/puppet_x/puppetlabs/splunk/type.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 0b0d317d..922ff5b1 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -26,19 +26,19 @@ def self.clone_type(type) end type.newparam(:setting) do desc 'The setting being defined.' - isnamevar - munge do |v| - v.to_s.strip - end - end - type.newparam(:section) do - desc 'The section the setting is defined under.' isnamevar munge do |v| v.to_s.strip end end - type.newparam(:name) + type.newparam(:section) do + desc 'The section the setting is defined under.' + isnamevar + munge do |v| + v.to_s.strip + end + end + type.newparam(:name) end end end From f84881ec623f22902dfba5988f0529e9c2077f9f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:33:46 +0200 Subject: [PATCH 19/35] rubocop: fix Style/SpaceInsideBlockBraces --- lib/puppet_x/puppetlabs/splunk/type.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 922ff5b1..06c9693e 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -12,8 +12,8 @@ def self.clone_type(type) [/^(.*\/\/.*)$/, [[:section]]], [/^(.*)\/(.*)$/, [ - [:section, lambda{|x| x}], - [:setting, lambda{|x| x}] + [:section, lambda{ |x| x }], + [:setting, lambda{ |x| x }] ] ] ] From 953eee8474699f184107719574915252717ffb45 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:33:57 +0200 Subject: [PATCH 20/35] rubocop: fix Style/SpaceBeforeBlockBraces --- lib/puppet_x/puppetlabs/splunk/type.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 06c9693e..728b92ac 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -12,8 +12,8 @@ def self.clone_type(type) [/^(.*\/\/.*)$/, [[:section]]], [/^(.*)\/(.*)$/, [ - [:section, lambda{ |x| x }], - [:setting, lambda{ |x| x }] + [:section, lambda { |x| x }], + [:setting, lambda { |x| x }] ] ] ] From e9662f5a3371ff420bf8b9b159a9bf3b81feefb2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:34:12 +0200 Subject: [PATCH 21/35] rubocop: fix Style/EmptyLinesAroundModuleBody --- lib/puppet_x/puppetlabs/splunk/type.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 728b92ac..74506041 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -2,7 +2,6 @@ module PuppetX module Puppetlabs module Splunk module Type - def self.clone_type(type) type.ensurable From d8b7a697c8d4b2b01de3aa9fd2a19519443c8f68 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:34:40 +0200 Subject: [PATCH 22/35] rubocop: fix RSpec/ExampleWording --- spec/acceptance/splunk_forwarder_spec.rb | 2 +- spec/acceptance/splunk_spec.rb | 2 +- spec/system/forwarder_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/acceptance/splunk_forwarder_spec.rb b/spec/acceptance/splunk_forwarder_spec.rb index 1ffa9e3b..11a48c9e 100644 --- a/spec/acceptance/splunk_forwarder_spec.rb +++ b/spec/acceptance/splunk_forwarder_spec.rb @@ -3,7 +3,7 @@ describe 'splunk::forwarder class' do context 'default parameters' do # Using puppet_apply as a helper - it 'should work idempotently with no errors' do + it 'works idempotently with no errors' do pp = <<-EOS class { '::splunk::forwarder': } EOS diff --git a/spec/acceptance/splunk_spec.rb b/spec/acceptance/splunk_spec.rb index 4ad22a92..210d7ba7 100644 --- a/spec/acceptance/splunk_spec.rb +++ b/spec/acceptance/splunk_spec.rb @@ -3,7 +3,7 @@ describe 'splunk class' do context 'default parameters' do # Using puppet_apply as a helper - it 'should work idempotently with no errors' do + it 'works idempotently with no errors' do pp = <<-EOS class { '::splunk': } EOS diff --git a/spec/system/forwarder_spec.rb b/spec/system/forwarder_spec.rb index f2d05ab3..4bdce4b2 100644 --- a/spec/system/forwarder_spec.rb +++ b/spec/system/forwarder_spec.rb @@ -2,7 +2,7 @@ require 'pry' describe 'setting up the forwarder' do - it 'should be able to set up a forwarder' do + it 'is able to set up a forwarder' do pp = <<-EOS class { 'splunk::params': version => '6.0', From efa7781b0a1d562fe07437842252296d20f191b0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:34:56 +0200 Subject: [PATCH 23/35] rubocop: fix Style/IndentArray --- lib/puppet/type/splunk_config.rb | 32 +++++++++++++------------- lib/puppet_x/puppetlabs/splunk/type.rb | 8 +++---- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index d80ec0a0..961c463e 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -24,22 +24,22 @@ ## Generate purge parameters for the splunk_config type [ - :purge_inputs, - :purge_outputs, - :purge_authentication, - :purge_authorize, - :purge_distsearch, - :purge_indexes, - :purge_limits, - :purge_props, - :purge_server, - :purge_transforms, - :purge_web, - :purge_forwarder_inputs, - :purge_forwarder_outputs, - :purge_forwarder_props, - :purge_forwarder_transforms, - :purge_forwarder_web + :purge_inputs, + :purge_outputs, + :purge_authentication, + :purge_authorize, + :purge_distsearch, + :purge_indexes, + :purge_limits, + :purge_props, + :purge_server, + :purge_transforms, + :purge_web, + :purge_forwarder_inputs, + :purge_forwarder_outputs, + :purge_forwarder_props, + :purge_forwarder_transforms, + :purge_forwarder_web ].each do |p| newparam(p) do newvalues(:true, :false) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 74506041..f7b5d9d7 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -10,10 +10,10 @@ def self.clone_type(type) [/^([^\/]*)$/, [[:section]]], [/^(.*\/\/.*)$/, [[:section]]], [/^(.*)\/(.*)$/, - [ - [:section, lambda { |x| x }], - [:setting, lambda { |x| x }] - ] + [ + [:section, lambda { |x| x }], + [:setting, lambda { |x| x }] + ] ] ] end From 1281e52cb53146006105b520e5dd9a5bb4aaef1f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:36:18 +0200 Subject: [PATCH 24/35] rubocop: fix Style/SpaceAroundOperators --- lib/puppet/provider/ini_setting/splunk.rb | 2 +- lib/puppet/type/splunk_distsearch.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index 760f93ec..e736e0e7 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -14,6 +14,6 @@ def self.file_path end def self.set_file_path(path) - @file_path=path + @file_path = path end end diff --git a/lib/puppet/type/splunk_distsearch.rb b/lib/puppet/type/splunk_distsearch.rb index 5d75ea4a..27c8c7b2 100644 --- a/lib/puppet/type/splunk_distsearch.rb +++ b/lib/puppet/type/splunk_distsearch.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type') Puppet::Type.newtype(:splunk_distsearch) do - @doc= 'Manage distsearch entries in distsearch.conf' + @doc = 'Manage distsearch entries in distsearch.conf' PuppetX::Puppetlabs::Splunk::Type.clone_type(self) end From 3037bd7e53e438f45e39d4667f9c856f5eb27ff6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 21:36:57 +0200 Subject: [PATCH 25/35] rubocop: fix Style/Lambda --- lib/puppet_x/puppetlabs/splunk/type.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index f7b5d9d7..906ca318 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -11,8 +11,8 @@ def self.clone_type(type) [/^(.*\/\/.*)$/, [[:section]]], [/^(.*)\/(.*)$/, [ - [:section, lambda { |x| x }], - [:setting, lambda { |x| x }] + [:section, ->(x) { x }], + [:setting, ->(x) { x }] ] ] ] From dfce39804e324d6f244c6757ecdbe51197d3e98a Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:24:23 +0100 Subject: [PATCH 26/35] rubocop: fix Style/RedundantReturn Signed-off-by: Alexander Fisher --- lib/puppet/type/splunk_config.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 961c463e..597d6c6d 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -75,7 +75,7 @@ def generate resources.concat(purge_splunk_resources(k)) if purge == :true end - return resources + resources end def set_provider_paths @@ -132,7 +132,7 @@ def purge_splunk_resources(klass) end end - return purge_resources + purge_resources end end From be947ee39023137931871e58d50c17f5cef91504 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:27:15 +0100 Subject: [PATCH 27/35] rubocop: fix Lint/BlockAlignment Signed-off-by: Alexander Fisher --- lib/puppet_x/puppetlabs/splunk/type.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 906ca318..93bde9db 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -24,12 +24,12 @@ def self.clone_type(type) end end type.newparam(:setting) do - desc 'The setting being defined.' - isnamevar - munge do |v| - v.to_s.strip - end - end + desc 'The setting being defined.' + isnamevar + munge do |v| + v.to_s.strip + end + end type.newparam(:section) do desc 'The section the setting is defined under.' isnamevar From 038a6679ba059c35eb1530e1015117260ba72918 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:29:23 +0100 Subject: [PATCH 28/35] rubocop: fix Style/IfUnlessModifier Signed-off-by: Alexander Fisher --- lib/puppet/type/splunk_config.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 597d6c6d..4525ba90 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -1,8 +1,6 @@ # Require all of our types so the class names are resolvable for purging Dir[File.dirname(__FILE__) + '/*.rb'].each do |file| - unless file == __FILE__ - require file - end + require file unless file == __FILE__ end Puppet::Type.newtype(:splunk_config) do From 4fdc6c99b91646fbabd860bd5d908b8d4e1b3be8 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:30:14 +0100 Subject: [PATCH 29/35] rubocop: fix Style/MultilineArrayBraceLayout Signed-off-by: Alexander Fisher --- lib/puppet_x/puppetlabs/splunk/type.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 93bde9db..1198bc4b 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -13,8 +13,7 @@ def self.clone_type(type) [ [:section, ->(x) { x }], [:setting, ->(x) { x }] - ] - ] + ]] ] end type.newproperty(:value) do From 762d19c305699ff16a60e7d1a44a953df0af02f0 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:30:51 +0100 Subject: [PATCH 30/35] rubocop: fix Style/EmptyLinesAroundBlockBody Signed-off-by: Alexander Fisher --- lib/puppet/type/splunk_config.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 4525ba90..0aaf5979 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -132,5 +132,4 @@ def purge_splunk_resources(klass) purge_resources end - end From 3ed559d8e74e0683c466dd47a8aafaac8ae9b64b Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:31:41 +0100 Subject: [PATCH 31/35] rubocop: fix Style/RedundantSelf Signed-off-by: Alexander Fisher --- lib/puppet/provider/ini_setting/splunk.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index e736e0e7..d02f401d 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -9,7 +9,7 @@ def self.file_path raise Puppet::Error, 'file_path must be set with splunk_config type before provider can be used' if @file_path.nil? - raise Puppet::Error, 'Child provider class does not support a file_name method' unless self.respond_to?(:file_name) + raise Puppet::Error, 'Child provider class does not support a file_name method' unless respond_to?(:file_name) File.join(@file_path, file_name) end From 4be4b26676857fcff69bb5144c621b9a606e5f02 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:34:31 +0100 Subject: [PATCH 32/35] rubocop: fix Style/Next Signed-off-by: Alexander Fisher --- lib/puppet/type/splunk_config.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 0aaf5979..fc95be32 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -120,14 +120,13 @@ def purge_splunk_resources(klass) # the instance name (setion/setting) isn't found in puppet_resources # Puppet::Type.type(type_name).instances.each do |instance| - unless puppet_resources.include?(instance.name) - purge_resources << Puppet::Type.type(type_name).new( - name: instance.name, - section: instance[:section], - setting: instance[:setting], - ensure: :absent - ) - end + next if puppet_resources.include?(instance.name) + purge_resources << Puppet::Type.type(type_name).new( + name: instance.name, + section: instance[:section], + setting: instance[:setting], + ensure: :absent + ) end purge_resources From 099079e66cc5bb7083e0dfaf8bc443ae4fbcacb9 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:37:15 +0100 Subject: [PATCH 33/35] rubocop: fix Lint/Void Signed-off-by: Alexander Fisher --- spec/system/forwarder_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/system/forwarder_spec.rb b/spec/system/forwarder_spec.rb index 4bdce4b2..2d438d34 100644 --- a/spec/system/forwarder_spec.rb +++ b/spec/system/forwarder_spec.rb @@ -13,7 +13,7 @@ class { 'splunk::forwarder': } # Run it twice and test for idempotency puppet_apply(pp) do |r| - r.exit_code.should_not == 1 + r.exit_code.should_not eq(1) r.refresh r.exit_code.should be_zero end @@ -39,7 +39,7 @@ class { 'splunk::forwarder': } # Run it twice and test for idempotency puppet_apply(pp) do |r| - r.exit_code.should_not == 1 + r.exit_code.should_not eq(1) r.refresh r.exit_code.should be_zero end From 161019c9d1508b93f1bf2d6d5cc6095bcb9d4125 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 26 Sep 2016 21:41:38 +0100 Subject: [PATCH 34/35] rubocop: fix Style/RegexpLiteral Signed-off-by: Alexander Fisher --- lib/puppet_x/puppetlabs/splunk/type.rb | 6 +++--- spec/system/forwarder_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 1198bc4b..83153212 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -7,9 +7,9 @@ def self.clone_type(type) type.define_singleton_method(:title_patterns) do [ - [/^([^\/]*)$/, [[:section]]], - [/^(.*\/\/.*)$/, [[:section]]], - [/^(.*)\/(.*)$/, + [%r{^([^\/]*)$}, [[:section]]], + [%r{^(.*\/\/.*)$}, [[:section]]], + [%r{^(.*)\/(.*)$}, [ [:section, ->(x) { x }], [:setting, ->(x) { x }] diff --git a/spec/system/forwarder_spec.rb b/spec/system/forwarder_spec.rb index 2d438d34..7ae3a8e0 100644 --- a/spec/system/forwarder_spec.rb +++ b/spec/system/forwarder_spec.rb @@ -46,6 +46,6 @@ class { 'splunk::forwarder': } end describe file('/opt/splunkforwarder/etc/system/local/transforms.conf') do - its(:content) { should match(/\[hadoop_severity\]\nREGEX=\\d\nFORMAT=severity/) } + its(:content) { should match(%r{\[hadoop_severity\]\nREGEX=\\d\nFORMAT=severity}) } end end From bead52a8543589584c3ff5f862c13874965653ce Mon Sep 17 00:00:00 2001 From: Craig Dunn Date: Wed, 28 Sep 2016 13:31:31 +0200 Subject: [PATCH 35/35] rubocop: fix Style/AccessorMethodName Changed set_file_path to be a simple attr_writer. --- lib/puppet/provider/ini_setting/splunk.rb | 8 ++++---- lib/puppet/type/splunk_config.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index d02f401d..98ca0f1d 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -7,13 +7,13 @@ @file_path = nil + class << self + attr_writer :file_path + end + def self.file_path raise Puppet::Error, 'file_path must be set with splunk_config type before provider can be used' if @file_path.nil? raise Puppet::Error, 'Child provider class does not support a file_name method' unless respond_to?(:file_name) File.join(@file_path, file_name) end - - def self.set_file_path(path) - @file_path = path - end end diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index fc95be32..09b58cbf 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -89,7 +89,7 @@ def set_provider_paths :splunk_transforms, :splunk_web ].each do |res_type| - Puppet::Type.type(res_type).provider(:ini_setting).set_file_path(self[:server_confdir]) + Puppet::Type.type(res_type).provider(:ini_setting).file_path = self[:server_confdir] end [ :splunkforwarder_input, @@ -98,7 +98,7 @@ def set_provider_paths :splunkforwarder_transforms, :splunkforwarder_web ].each do |res_type| - Puppet::Type.type(res_type).provider(:ini_setting).set_file_path(self[:forwarder_confdir]) + Puppet::Type.type(res_type).provider(:ini_setting).file_path = self[:forwarder_confdir] end end