Skip to content

Commit

Permalink
rubocop unsafe autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
root-expert committed Jul 3, 2022
1 parent d39bf90 commit dd16ab8
Show file tree
Hide file tree
Showing 68 changed files with 140 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/facter/splunk_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Facter.add(:splunk_version) do
setcode do
value = nil
Expand Down
2 changes: 2 additions & 0 deletions lib/facter/splunkforwarder_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Facter.add(:splunkforwarder_version) do
setcode do
value = nil
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/ini_setting/splunk.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:ini_setting).provide(
:splunk,
parent: Puppet::Type.type(:ini_setting).provider(:ruby)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_alert_actions/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_alert_actions).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_authentication/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_authentication).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_authorize/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_authorize).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_deploymentclient/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_deploymentclient).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_distsearch/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_distsearch).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_indexes/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_indexes).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_input/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_input).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_limits/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_limits).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/splunk_metadata/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'puppet/util/ini_file'

class SectionNoGlobal < Puppet::Util::IniFile::Section
Expand Down Expand Up @@ -44,7 +46,7 @@ def file_path
# {app/foo,system}/{default,local} -> {app/foo,system}/metadata/{default,local}.meta
ctxelem = File.split(context)
if %w[local default].include?(ctxelem[-1])
file_name = ctxelem[-1] + '.meta'
file_name = "#{ctxelem[-1]}.meta"
context = File.join(ctxelem[0..-2], 'metadata')
end

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

Puppet::Type.type(:splunk_output).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_props/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_props).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_server/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_server).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_serverclass/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_serverclass).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_transforms/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_transforms).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_uiprefs/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_uiprefs).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunk_web/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunk_web).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_deploymentclient).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_input/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_input).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_limits/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_limits).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_output/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_output).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_props/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_props).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_server/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_server).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_transforms).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/splunkforwarder_web/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Puppet::Type.type(:splunkforwarder_web).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_alert_actions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_alert_actions) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_authentication.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_authentication) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_authorize.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_authorize) do
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/type/splunk_config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

# Require all of our types so the class names are resolvable for purging
Dir[File.dirname(__FILE__) + '/splunk*.rb'].each do |file|
Dir["#{File.dirname(__FILE__)}/splunk*.rb"].sort.each do |file|
require file unless file == __FILE__
end

Expand Down Expand Up @@ -156,7 +158,7 @@ def purge_splunk_resources_in_context(type_class, context)
catalog_resources = catalog.resources.select { |r| r.is_a?(type_class) && r[:context] == context }
Puppet.debug "Found #{catalog_resources.size} #{type_class} resources in context #{context}"
catalog_resources.each do |res|
puppet_resources << (res[:section] + '/' + res[:setting])
puppet_resources << ("#{res[:section]}/#{res[:setting]}")
end

# Search the configured instances of the class type and purge them if
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_deploymentclient.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_deploymentclient) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_distsearch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_distsearch) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_indexes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_indexes) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_input.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_input) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_limits.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_limits) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_metadata.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_metadata) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_output.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_output) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_props.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_props) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_server.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_server) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_serverclass.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_serverclass) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_transforms.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_transforms) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_uiprefs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_uiprefs) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_web.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_web) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_deploymentclient.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_deploymentclient) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_input.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_input) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_limits.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_limits) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_output.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_output) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_props.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_props) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_server.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_server) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_transforms.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_transforms) do
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/type/splunkforwarder_web.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_web) do
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet_x/puppetlabs/splunk/type.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.join(File.dirname(__FILE__), '..', '..', 'voxpupuli/splunk/util')

module PuppetX
Expand All @@ -9,7 +11,7 @@ def self.clone_type(type)

type.define_singleton_method(:title_patterns) do
[
[%r{^([^/]*)$}, [[:section]]], # matches section titles without slashes, like 'tcpout:indexers'
[%r{^([^/]*)$}, [[:section]]], # matches section titles without slashes, like 'tcpout:indexers'
[%r{^(.*//.*)/(.*)$}, # matches section titles containing '//' and a setting,
[ # like: 'monitor:///var/log/messages/index'
[:section], # where 'monitor:///var/log/messages' is the section
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet_x/voxpupuli/splunk/util.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'openssl'
require 'base64'

Expand All @@ -11,7 +13,7 @@ def self.decrypt(secrets_file, value)
Puppet.debug "Decrypting splunk >= 7.2 data using secret from #{secrets_file}"
value.slice!(0, 3)
data = Base64.strict_decode64(value)
splunk_secret = IO.binread(secrets_file).chomp
splunk_secret = File.binread(secrets_file).chomp

iv = data.bytes[0, 16].pack('c*')
tag = data.bytes[-16..-1].pack('c*')
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/splunk_enterprise_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'splunk enterprise class' do
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/splunk_forwarder_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'splunk::forwarder class' do
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/enterprise_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

shared_examples_for 'splunk enterprise nix defaults' do
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/forwarder_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

shared_examples_for 'splunk forwarder' do
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/splunk_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'splunk' do
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/addon_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'splunk::addon' do
Expand Down
Loading

0 comments on commit dd16ab8

Please sign in to comment.