From 01c81ec37a980d5afc513f508015f32943f2f4ad Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 18 Sep 2021 00:32:11 +0200 Subject: [PATCH 01/21] modulesync 4.2.0 --- .github/workflows/ci.yml | 17 +++++++++++++---- .msync.yml | 2 +- Gemfile | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4934774a..d08d05e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ name: CI on: pull_request +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + jobs: setup_matrix: name: 'Setup Test Matrix' @@ -64,10 +68,6 @@ jobs: include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 @@ -79,3 +79,12 @@ jobs: env: BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} BEAKER_setfile: ${{ matrix.setfile.value }} + + tests: + needs: + - unit + - acceptance + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/.msync.yml b/.msync.yml index 9c9f18f9..43966c2f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '4.1.0' +modulesync_config_version: '4.2.0' diff --git a/Gemfile b/Gemfile index 590bbedf..a39114ce 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.1', :require => false + gem 'voxpupuli-test', '~> 2.5', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -20,7 +20,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' gem 'voxpupuli-release', '>= 1.0.2', :require => false gem 'puppet-strings', '>= 2.2', :require => false end From b1919d879f793664ae723654748a1ec4b8a777a2 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 18 Sep 2021 20:41:35 +0200 Subject: [PATCH 02/21] Add sleep to acceptance tests --- spec/acceptance/splunk_enterprise_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/acceptance/splunk_enterprise_spec.rb b/spec/acceptance/splunk_enterprise_spec.rb index 22863751..ee77db41 100644 --- a/spec/acceptance/splunk_enterprise_spec.rb +++ b/spec/acceptance/splunk_enterprise_spec.rb @@ -18,6 +18,8 @@ class { 'splunk::enterprise': } # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) + # give splunk some time to start + sleep(10) end describe package('splunk') do @@ -52,6 +54,8 @@ class { 'splunk::enterprise': EOS apply_manifest(pp, catch_failures: true) + # give splunk some time to start + sleep(10) end it 'works idempotently with no errors' do From f236555b3dde8cfd6eeaba9c10b11038bf923b4f Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 21:01:08 +0100 Subject: [PATCH 03/21] modulesync 5.1.0 --- .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 4 ++-- Rakefile | 2 +- spec/spec_helper.rb | 10 +++++----- 5 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .puppet-lint.rc diff --git a/.msync.yml b/.msync.yml index 43966c2f..a83abd9b 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '4.2.0' +modulesync_config_version: '5.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 00000000..dd8272c7 --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/Gemfile b/Gemfile index a39114ce..b6dcf456 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'voxpupuli-test', '~> 5.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -21,7 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'voxpupuli-release', '>= 1.2.0', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 80b799d6..f92f0516 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 75fe9487..634e1933 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1,18 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. -ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end From 9357c758a0732beea5190486011af9d7315ac97d Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 3 Jul 2022 12:26:35 +0300 Subject: [PATCH 04/21] modulesync 5.3.0 --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +-- 6 files changed, 24 insertions(+), 109 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b55..8b466cfb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e8..8a077911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba694..15f17213 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9b..02353859 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.3.0' diff --git a/Dockerfile b/Dockerfile index e3cf307f..8dd82d63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf456..07209b79 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From 627af7015532860e0bffc6e644a92aba4623ee91 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 3 Jul 2022 12:31:31 +0300 Subject: [PATCH 05/21] rubocop safe autocorrect --- lib/facter/splunk_version.rb | 2 +- lib/facter/splunkforwarder_version.rb | 4 +- lib/puppet/provider/ini_setting/splunk.rb | 2 +- lib/puppet/type/splunk_config.rb | 103 +++++++++--------- lib/puppet_x/puppetlabs/splunk/type.rb | 10 +- lib/puppet_x/voxpupuli/splunk/util.rb | 4 +- spec/acceptance/splunk_enterprise_spec.rb | 1 + spec/acceptance/splunk_forwarder_spec.rb | 10 +- spec/spec_helper.rb | 2 +- spec/spec_helper_acceptance.rb | 2 +- spec/splunk_data.rb | 1 - spec/unit/puppet/type/splunk_config_spec.rb | 2 +- spec/unit/puppet/type/splunk_types_spec.rb | 7 +- .../puppet_x/voxpupuli/splunk/util_spec.rb | 1 + 14 files changed, 78 insertions(+), 73 deletions(-) diff --git a/lib/facter/splunk_version.rb b/lib/facter/splunk_version.rb index 515d344c..f5596ef2 100755 --- a/lib/facter/splunk_version.rb +++ b/lib/facter/splunk_version.rb @@ -8,7 +8,7 @@ end if cmd output = Facter::Util::Resolution.exec(cmd) - if output =~ %r{^Splunk ([0-9\.]+) \(} # rubocop:disable Style/IfUnlessModifier + if output =~ %r{^Splunk ([0-9.]+) \(} # rubocop:disable Style/IfUnlessModifier value = Regexp.last_match(1) end end diff --git a/lib/facter/splunkforwarder_version.rb b/lib/facter/splunkforwarder_version.rb index 7732148b..3a90e169 100755 --- a/lib/facter/splunkforwarder_version.rb +++ b/lib/facter/splunkforwarder_version.rb @@ -8,9 +8,7 @@ end if cmd output = Facter::Util::Resolution.exec(cmd) - if output =~ %r{^Splunk Universal Forwarder ([0-9\.]+) \(} - value = Regexp.last_match(1) - end + value = Regexp.last_match(1) if output =~ %r{^Splunk Universal Forwarder ([0-9.]+) \(} end value end diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index 04c802fe..c29043a1 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -2,7 +2,6 @@ :splunk, parent: Puppet::Type.type(:ini_setting).provider(:ruby) ) do - confine true: false # Never automatically select this provider @file_path = nil @@ -14,6 +13,7 @@ class << self def self.file_path raise Puppet::Error, 'file_path must be set with splunkenterprise_config or splunkforwarder_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_path end diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 7ae42011..776d6945 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -21,30 +21,30 @@ end ## Generate purge parameters for the splunk_config type - [ - :purge_inputs, - :purge_outputs, - :purge_alert_actions, - :purge_authentication, - :purge_authorize, - :purge_deploymentclient, - :purge_distsearch, - :purge_indexes, - :purge_limits, - :purge_metadata, - :purge_props, - :purge_server, - :purge_serverclass, - :purge_transforms, - :purge_web, - :purge_uiprefs, - :purge_forwarder_deploymentclient, - :purge_forwarder_inputs, - :purge_forwarder_outputs, - :purge_forwarder_props, - :purge_forwarder_transforms, - :purge_forwarder_web, - :purge_forwarder_server + %i[ + purge_inputs + purge_outputs + purge_alert_actions + purge_authentication + purge_authorize + purge_deploymentclient + purge_distsearch + purge_indexes + purge_limits + purge_metadata + purge_props + purge_server + purge_serverclass + purge_transforms + purge_web + purge_uiprefs + purge_forwarder_deploymentclient + purge_forwarder_inputs + purge_forwarder_outputs + purge_forwarder_props + purge_forwarder_transforms + purge_forwarder_web + purge_forwarder_server ].each do |p| newparam(p) do newvalues(:true, :false) @@ -91,36 +91,36 @@ def generate end def set_provider_paths - [ - :splunk_alert_actions, - :splunk_authentication, - :splunk_authorize, - :splunk_deploymentclient, - :splunk_distsearch, - :splunk_indexes, - :splunk_limits, - :splunk_input, - :splunk_output, - :splunk_metadata, - :splunk_props, - :splunk_server, - :splunk_serverclass, - :splunk_transforms, - :splunk_web, - :splunk_uiprefs + %i[ + splunk_alert_actions + splunk_authentication + splunk_authorize + splunk_deploymentclient + splunk_distsearch + splunk_indexes + splunk_limits + splunk_input + splunk_output + splunk_metadata + splunk_props + splunk_server + splunk_serverclass + splunk_transforms + splunk_web + splunk_uiprefs ].each do |res_type| provider_class = Puppet::Type.type(res_type).provider(:ini_setting) provider_class.file_path = self[:server_confdir] end - [ - :splunkforwarder_deploymentclient, - :splunkforwarder_input, - :splunkforwarder_output, - :splunkforwarder_props, - :splunkforwarder_transforms, - :splunkforwarder_web, - :splunkforwarder_server, - :splunkforwarder_limits + %i[ + splunkforwarder_deploymentclient + splunkforwarder_input + splunkforwarder_output + splunkforwarder_props + splunkforwarder_transforms + splunkforwarder_web + splunkforwarder_server + splunkforwarder_limits ].each do |res_type| provider_class = Puppet::Type.type(res_type).provider(:ini_setting) provider_class.file_path = self[:forwarder_confdir] @@ -156,7 +156,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 @@ -178,6 +178,7 @@ def purge_splunk_resources_in_context(type_class, context) instances.each do |instance| next if puppet_resources.include?(instance.name) + purge_resources << Puppet::Type.type(type_name).new( name: "Purge #{context} #{instance.name}", section: instance[:section], diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index c576200d..506679f9 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -9,14 +9,14 @@ def self.clone_type(type) type.define_singleton_method(:title_patterns) do [ - [%r{^([^\/]*)$}, [[:section]]], # matches section titles without slashes, like 'tcpout:indexers' - [%r{^(.*\/\/.*)\/(.*)$}, # matches section titles containing '//' and a setting, - [ # like: 'monitor:///var/log/messages/index' + [%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 [:setting] # and 'index' is the setting. ]], - [%r{^(.*\/\/.*)$}, [[:section]]], # matches section titles containing '//', like 'tcp://127.0.0.1:19500' - [%r{^(.*)\/(.*)$}, # matches plain 'section/setting' titles, like: 'tcpout:indexers/server' + [%r{^(.*//.*)$}, [[:section]]], # matches section titles containing '//', like 'tcp://127.0.0.1:19500' + [%r{^(.*)/(.*)$}, # matches plain 'section/setting' titles, like: 'tcpout:indexers/server' [ [:section], [:setting] diff --git a/lib/puppet_x/voxpupuli/splunk/util.rb b/lib/puppet_x/voxpupuli/splunk/util.rb index 1148cfd3..14d065c3 100644 --- a/lib/puppet_x/voxpupuli/splunk/util.rb +++ b/lib/puppet_x/voxpupuli/splunk/util.rb @@ -17,8 +17,8 @@ def self.decrypt(secrets_file, value) tag = data.bytes[-16..-1].pack('c*') ciphertext = data.bytes[16..-17].pack('c*') - decipher = OpenSSL::Cipher::AES.new(256, :GCM).decrypt - decipher.key = OpenSSL::PKCS5.pbkdf2_hmac(splunk_secret, 'disk-encryption', 1, 32, OpenSSL::Digest::SHA256.new) + decipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt + decipher.key = OpenSSL::PKCS5.pbkdf2_hmac(splunk_secret, 'disk-encryption', 1, 32, OpenSSL::Digest.new('SHA256')) decipher.iv_len = 16 decipher.iv = iv decipher.auth_tag = tag diff --git a/spec/acceptance/splunk_enterprise_spec.rb b/spec/acceptance/splunk_enterprise_spec.rb index ee77db41..0c3e5158 100644 --- a/spec/acceptance/splunk_enterprise_spec.rb +++ b/spec/acceptance/splunk_enterprise_spec.rb @@ -88,6 +88,7 @@ class { 'splunk::enterprise': EOS apply_manifest(pp, catch_failures: true) end + describe package('splunk') do it { is_expected.not_to be_installed } end diff --git a/spec/acceptance/splunk_forwarder_spec.rb b/spec/acceptance/splunk_forwarder_spec.rb index 953ecd68..a4911ceb 100644 --- a/spec/acceptance/splunk_forwarder_spec.rb +++ b/spec/acceptance/splunk_forwarder_spec.rb @@ -42,17 +42,18 @@ class { 'splunk::forwarder': it { is_expected.to be_running } end end + context 'purging' do context 'purge_outputs => false' do it 'works idempotently with no errors' do - pp = <<-eos + pp = <<-EOS class { 'splunk::params': } class { 'splunk::forwarder': splunkd_port => 8090, purge_outputs => false, } - eos + EOS # run it twice and test for idempotency apply_manifest(pp, catch_failures: true) @@ -64,16 +65,17 @@ class { 'splunk::forwarder': its(:content) { is_expected.to match %r{^sslPassword} } end end + context 'purge_outputs => true' do it 'works idempotently with no errors' do - pp = <<-eos + pp = <<-EOS class { 'splunk::params': } class { 'splunk::forwarder': splunkd_port => 8090, purge_outputs => true, } - eos + EOS # run it twice and test for idempotency apply_manifest(pp, catch_failures: true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 634e1933..69c72a82 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,6 @@ end end -require 'splunk_data.rb' +require 'splunk_data' $LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index ceee61f7..349400b2 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,5 +1,5 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -require 'splunk_data.rb' +require 'splunk_data' configure_beaker do |host| # Need to stage the Splunk/Splunkforwarder packages here. diff --git a/spec/splunk_data.rb b/spec/splunk_data.rb index 2d2c3cea..43de3d04 100644 --- a/spec/splunk_data.rb +++ b/spec/splunk_data.rb @@ -1,4 +1,3 @@ - SPLUNK_SERVER_TYPES = { splunk_alert_actions: 'alert_actions.conf', splunk_authentication: 'authentication.conf', diff --git a/spec/unit/puppet/type/splunk_config_spec.rb b/spec/unit/puppet/type/splunk_config_spec.rb index 18f91bd9..5ebfdffd 100644 --- a/spec/unit/puppet/type/splunk_config_spec.rb +++ b/spec/unit/puppet/type/splunk_config_spec.rb @@ -26,7 +26,7 @@ file_path = File.join('/opt/splunkforwarder/etc/system/local', file_name) end - it "should configure the #{type} type with file path #{file_path}" do + it "configures the #{type} type with file path #{file_path}" do resource = Puppet::Type.type(type).new(name: 'foo', setting: 'foo', section: 'foo') provider = Puppet::Type.type(type).provider(:ini_setting).new(resource) expect(provider.file_path).to eq(file_path) diff --git a/spec/unit/puppet/type/splunk_types_spec.rb b/spec/unit/puppet/type/splunk_types_spec.rb index 76b15a90..2c861d0b 100644 --- a/spec/unit/puppet/type/splunk_types_spec.rb +++ b/spec/unit/puppet/type/splunk_types_spec.rb @@ -5,7 +5,7 @@ SPLUNK_TYPES.each do |type, file_name| describe Puppet::Type.type(type) do context 'attributes' do - [:name, :setting, :section, :context].each do |parameter| + %i[name setting section context].each do |parameter| describe parameter.to_s do it 'has a name attribute' do expect(described_class.attrclass(parameter)).not_to be_nil @@ -26,7 +26,7 @@ end it 'has name, context, setting and section as namevars' do - expect(described_class.key_attributes.sort).to eq([:context, :name, :section, :setting]) + expect(described_class.key_attributes.sort).to eq(%i[context name section setting]) end end @@ -60,6 +60,7 @@ type = described_class.new(title: 'foo/bar', setting: 'tango', section: 'delta') expect(type[:section]).to eq('delta') end + it 'ignores title when setting is declared' do type = described_class.new(title: 'foo/bar', setting: 'tango', section: 'delta') expect(type[:setting]).to eq('tango') @@ -76,6 +77,7 @@ it 'has a value property' do expect(described_class.attrtype(:value)).to eq(:property) end + context 'when testing value is insync' do let(:resource) { described_class.new(title: 'foo/bar', value: 'value') } let(:property) { resource.property(:value) } @@ -92,6 +94,7 @@ property.should = 'value' expect(property).to be_safe_insync('value') end + it 'is insync if encrypted `is` value matches `should` value after being decrypted' do property.should = 'temp1234' allow(File).to receive(:file?).with(%r{/opt/splunk(forwarder)?/etc/auth/splunk\.secret$}).and_return(true) diff --git a/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb b/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb index 4f44a845..46704891 100644 --- a/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb +++ b/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb @@ -8,6 +8,7 @@ expect(described_class.decrypt('secrets_file', 'non_encrypted_value')).to eq 'non_encrypted_value' end end + context 'when called with splunk 7.2 encrypted value' do let(:encrypted_value) { '$7$aTVkS01HYVNJUk5wSnR5NIu4GXLhj2Qd49n2B6Y8qmA/u1CdL9JYxQ==' } let(:splunk_secret) { 'JX7cQAnH6Nznmild8MvfN8/BLQnGr8C3UYg3mqvc3ArFkaxj4gUt1RUCaRBD/r0CNn8xOA2oKX8/0uyyChyGRiFKhp6h2FA+ydNIRnN46N8rZov8QGkchmebZa5GAM5U50GbCCgzJFObPyWi5yT8CrSCYmv9cpRtpKyiX+wkhJwltoJzAxWbBERiLp+oXZnN3lsRn6YkljmYBqN9tZLTVVpsLvqvkezPgpv727Fd//5dRoWsWBv2zRp0mwDv3tj' } From ada8abafe5e6e398ea2b066476f706f2c044d7f3 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 3 Jul 2022 12:33:10 +0300 Subject: [PATCH 06/21] rubocop unsafe autocorrect --- lib/facter/splunk_version.rb | 2 ++ lib/facter/splunkforwarder_version.rb | 2 ++ lib/puppet/provider/ini_setting/splunk.rb | 2 ++ lib/puppet/provider/splunk_alert_actions/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_authentication/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_authorize/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_deploymentclient/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_metadata/ini_setting.rb | 4 +++- 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_serverclass/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_transforms/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_uiprefs/ini_setting.rb | 2 ++ lib/puppet/provider/splunk_web/ini_setting.rb | 2 ++ .../splunkforwarder_deploymentclient/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_input/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_limits/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_output/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_props/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_server/ini_setting.rb | 2 ++ .../provider/splunkforwarder_transforms/ini_setting.rb | 2 ++ lib/puppet/provider/splunkforwarder_web/ini_setting.rb | 2 ++ lib/puppet/type/splunk_alert_actions.rb | 2 ++ lib/puppet/type/splunk_authentication.rb | 2 ++ lib/puppet/type/splunk_authorize.rb | 2 ++ lib/puppet/type/splunk_config.rb | 6 ++++-- lib/puppet/type/splunk_deploymentclient.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_metadata.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_serverclass.rb | 2 ++ lib/puppet/type/splunk_transforms.rb | 2 ++ lib/puppet/type/splunk_uiprefs.rb | 2 ++ lib/puppet/type/splunk_web.rb | 2 ++ lib/puppet/type/splunkforwarder_deploymentclient.rb | 2 ++ lib/puppet/type/splunkforwarder_input.rb | 2 ++ lib/puppet/type/splunkforwarder_limits.rb | 2 ++ lib/puppet/type/splunkforwarder_output.rb | 2 ++ lib/puppet/type/splunkforwarder_props.rb | 2 ++ lib/puppet/type/splunkforwarder_server.rb | 2 ++ lib/puppet/type/splunkforwarder_transforms.rb | 2 ++ lib/puppet/type/splunkforwarder_web.rb | 2 ++ lib/puppet_x/puppetlabs/splunk/type.rb | 4 +++- lib/puppet_x/voxpupuli/splunk/util.rb | 4 +++- spec/acceptance/splunk_enterprise_spec.rb | 2 ++ spec/acceptance/splunk_forwarder_spec.rb | 2 ++ spec/classes/enterprise_spec.rb | 2 ++ spec/classes/forwarder_spec.rb | 2 ++ spec/classes/splunk_spec.rb | 2 ++ spec/defines/addon_spec.rb | 2 ++ spec/spec_helper.rb | 2 +- spec/spec_helper_acceptance.rb | 2 ++ spec/splunk_data.rb | 2 ++ spec/unit/facter/splunk_version_spec.rb | 2 ++ spec/unit/facter/splunkforwarder_version_spec.rb | 2 ++ spec/unit/puppet/type/splunk_config_spec.rb | 2 ++ spec/unit/puppet/type/splunk_types_spec.rb | 2 ++ spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb | 2 ++ 68 files changed, 140 insertions(+), 6 deletions(-) diff --git a/lib/facter/splunk_version.rb b/lib/facter/splunk_version.rb index f5596ef2..747f9ddb 100755 --- a/lib/facter/splunk_version.rb +++ b/lib/facter/splunk_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Facter.add(:splunk_version) do setcode do value = nil diff --git a/lib/facter/splunkforwarder_version.rb b/lib/facter/splunkforwarder_version.rb index 3a90e169..fd3e7fbe 100755 --- a/lib/facter/splunkforwarder_version.rb +++ b/lib/facter/splunkforwarder_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Facter.add(:splunkforwarder_version) do setcode do value = nil diff --git a/lib/puppet/provider/ini_setting/splunk.rb b/lib/puppet/provider/ini_setting/splunk.rb index c29043a1..d04c3ea5 100644 --- a/lib/puppet/provider/ini_setting/splunk.rb +++ b/lib/puppet/provider/ini_setting/splunk.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:ini_setting).provide( :splunk, parent: Puppet::Type.type(:ini_setting).provider(:ruby) diff --git a/lib/puppet/provider/splunk_alert_actions/ini_setting.rb b/lib/puppet/provider/splunk_alert_actions/ini_setting.rb index 21899697..965f89a0 100644 --- a/lib/puppet/provider/splunk_alert_actions/ini_setting.rb +++ b/lib/puppet/provider/splunk_alert_actions/ini_setting.rb @@ -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) diff --git a/lib/puppet/provider/splunk_authentication/ini_setting.rb b/lib/puppet/provider/splunk_authentication/ini_setting.rb index 4767564a..afbfe029 100644 --- a/lib/puppet/provider/splunk_authentication/ini_setting.rb +++ b/lib/puppet/provider/splunk_authentication/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_authentication).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_authorize/ini_setting.rb b/lib/puppet/provider/splunk_authorize/ini_setting.rb index 104b8f50..3371e02a 100644 --- a/lib/puppet/provider/splunk_authorize/ini_setting.rb +++ b/lib/puppet/provider/splunk_authorize/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_authorize).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_deploymentclient/ini_setting.rb b/lib/puppet/provider/splunk_deploymentclient/ini_setting.rb index 90bf9c25..9d5ecec2 100644 --- a/lib/puppet/provider/splunk_deploymentclient/ini_setting.rb +++ b/lib/puppet/provider/splunk_deploymentclient/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_deploymentclient).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_distsearch/ini_setting.rb b/lib/puppet/provider/splunk_distsearch/ini_setting.rb index e9ee9cf5..e04e5fa5 100644 --- a/lib/puppet/provider/splunk_distsearch/ini_setting.rb +++ b/lib/puppet/provider/splunk_distsearch/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_distsearch).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_indexes/ini_setting.rb b/lib/puppet/provider/splunk_indexes/ini_setting.rb index edeefdc7..46e8dfad 100644 --- a/lib/puppet/provider/splunk_indexes/ini_setting.rb +++ b/lib/puppet/provider/splunk_indexes/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_indexes).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_input/ini_setting.rb b/lib/puppet/provider/splunk_input/ini_setting.rb index b8203404..6119c40e 100644 --- a/lib/puppet/provider/splunk_input/ini_setting.rb +++ b/lib/puppet/provider/splunk_input/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_input).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_limits/ini_setting.rb b/lib/puppet/provider/splunk_limits/ini_setting.rb index 2b1ea79f..552908ae 100644 --- a/lib/puppet/provider/splunk_limits/ini_setting.rb +++ b/lib/puppet/provider/splunk_limits/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_limits).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_metadata/ini_setting.rb b/lib/puppet/provider/splunk_metadata/ini_setting.rb index d96cbbd9..8453ff76 100644 --- a/lib/puppet/provider/splunk_metadata/ini_setting.rb +++ b/lib/puppet/provider/splunk_metadata/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/util/ini_file' class SectionNoGlobal < Puppet::Util::IniFile::Section @@ -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 diff --git a/lib/puppet/provider/splunk_output/ini_setting.rb b/lib/puppet/provider/splunk_output/ini_setting.rb index f5959686..1ff7e758 100644 --- a/lib/puppet/provider/splunk_output/ini_setting.rb +++ b/lib/puppet/provider/splunk_output/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_output).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_props/ini_setting.rb b/lib/puppet/provider/splunk_props/ini_setting.rb index 86edd22c..2fc65f11 100644 --- a/lib/puppet/provider/splunk_props/ini_setting.rb +++ b/lib/puppet/provider/splunk_props/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_props).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_server/ini_setting.rb b/lib/puppet/provider/splunk_server/ini_setting.rb index 43c12205..4beab3f0 100644 --- a/lib/puppet/provider/splunk_server/ini_setting.rb +++ b/lib/puppet/provider/splunk_server/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_server).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_serverclass/ini_setting.rb b/lib/puppet/provider/splunk_serverclass/ini_setting.rb index 17996045..1954b9d1 100644 --- a/lib/puppet/provider/splunk_serverclass/ini_setting.rb +++ b/lib/puppet/provider/splunk_serverclass/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_serverclass).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_transforms/ini_setting.rb b/lib/puppet/provider/splunk_transforms/ini_setting.rb index 1dc0086a..87eed3df 100644 --- a/lib/puppet/provider/splunk_transforms/ini_setting.rb +++ b/lib/puppet/provider/splunk_transforms/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_transforms).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_uiprefs/ini_setting.rb b/lib/puppet/provider/splunk_uiprefs/ini_setting.rb index 1430dfa7..e7166e14 100644 --- a/lib/puppet/provider/splunk_uiprefs/ini_setting.rb +++ b/lib/puppet/provider/splunk_uiprefs/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_uiprefs).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunk_web/ini_setting.rb b/lib/puppet/provider/splunk_web/ini_setting.rb index f70f7f3c..a24c2cb9 100644 --- a/lib/puppet/provider/splunk_web/ini_setting.rb +++ b/lib/puppet/provider/splunk_web/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunk_web).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_deploymentclient/ini_setting.rb b/lib/puppet/provider/splunkforwarder_deploymentclient/ini_setting.rb index c8470622..1a202b3f 100644 --- a/lib/puppet/provider/splunkforwarder_deploymentclient/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_deploymentclient/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_deploymentclient).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_input/ini_setting.rb b/lib/puppet/provider/splunkforwarder_input/ini_setting.rb index 74fabd8f..110b000d 100644 --- a/lib/puppet/provider/splunkforwarder_input/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_input/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_input).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_limits/ini_setting.rb b/lib/puppet/provider/splunkforwarder_limits/ini_setting.rb index 42c3e731..7d2c8fa4 100644 --- a/lib/puppet/provider/splunkforwarder_limits/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_limits/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_limits).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb index ae46e175..3df85802 100644 --- a/lib/puppet/provider/splunkforwarder_output/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_output/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_output).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_props/ini_setting.rb b/lib/puppet/provider/splunkforwarder_props/ini_setting.rb index d8cb0558..19fb45c1 100644 --- a/lib/puppet/provider/splunkforwarder_props/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_props/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_props).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_server/ini_setting.rb b/lib/puppet/provider/splunkforwarder_server/ini_setting.rb index 88917452..a544a614 100644 --- a/lib/puppet/provider/splunkforwarder_server/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_server/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_server).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb b/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb index 8b127000..5069ff10 100644 --- a/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_transforms).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/provider/splunkforwarder_web/ini_setting.rb b/lib/puppet/provider/splunkforwarder_web/ini_setting.rb index 88d4ec32..0f235502 100644 --- a/lib/puppet/provider/splunkforwarder_web/ini_setting.rb +++ b/lib/puppet/provider/splunkforwarder_web/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:splunkforwarder_web).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:splunk) diff --git a/lib/puppet/type/splunk_alert_actions.rb b/lib/puppet/type/splunk_alert_actions.rb index 76a017c6..ca526221 100644 --- a/lib/puppet/type/splunk_alert_actions.rb +++ b/lib/puppet/type/splunk_alert_actions.rb @@ -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 diff --git a/lib/puppet/type/splunk_authentication.rb b/lib/puppet/type/splunk_authentication.rb index 4b81ac00..e70f8026 100644 --- a/lib/puppet/type/splunk_authentication.rb +++ b/lib/puppet/type/splunk_authentication.rb @@ -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 diff --git a/lib/puppet/type/splunk_authorize.rb b/lib/puppet/type/splunk_authorize.rb index c2c2c2c2..1fa9a5d1 100644 --- a/lib/puppet/type/splunk_authorize.rb +++ b/lib/puppet/type/splunk_authorize.rb @@ -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 diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index 776d6945..f9ce37b9 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -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 @@ -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 diff --git a/lib/puppet/type/splunk_deploymentclient.rb b/lib/puppet/type/splunk_deploymentclient.rb index 8bb567ab..294afa05 100644 --- a/lib/puppet/type/splunk_deploymentclient.rb +++ b/lib/puppet/type/splunk_deploymentclient.rb @@ -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 diff --git a/lib/puppet/type/splunk_distsearch.rb b/lib/puppet/type/splunk_distsearch.rb index 27c8c7b2..a65e48d5 100644 --- a/lib/puppet/type/splunk_distsearch.rb +++ b/lib/puppet/type/splunk_distsearch.rb @@ -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 diff --git a/lib/puppet/type/splunk_indexes.rb b/lib/puppet/type/splunk_indexes.rb index 90607a68..196f6e27 100644 --- a/lib/puppet/type/splunk_indexes.rb +++ b/lib/puppet/type/splunk_indexes.rb @@ -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 diff --git a/lib/puppet/type/splunk_input.rb b/lib/puppet/type/splunk_input.rb index 5c2f1861..57ec0417 100644 --- a/lib/puppet/type/splunk_input.rb +++ b/lib/puppet/type/splunk_input.rb @@ -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 diff --git a/lib/puppet/type/splunk_limits.rb b/lib/puppet/type/splunk_limits.rb index 29fb7c69..664beacf 100644 --- a/lib/puppet/type/splunk_limits.rb +++ b/lib/puppet/type/splunk_limits.rb @@ -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 diff --git a/lib/puppet/type/splunk_metadata.rb b/lib/puppet/type/splunk_metadata.rb index c90c347f..285bf553 100644 --- a/lib/puppet/type/splunk_metadata.rb +++ b/lib/puppet/type/splunk_metadata.rb @@ -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 diff --git a/lib/puppet/type/splunk_output.rb b/lib/puppet/type/splunk_output.rb index ab2b9658..76a58e90 100644 --- a/lib/puppet/type/splunk_output.rb +++ b/lib/puppet/type/splunk_output.rb @@ -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 diff --git a/lib/puppet/type/splunk_props.rb b/lib/puppet/type/splunk_props.rb index db1ce094..7db6340b 100644 --- a/lib/puppet/type/splunk_props.rb +++ b/lib/puppet/type/splunk_props.rb @@ -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 diff --git a/lib/puppet/type/splunk_server.rb b/lib/puppet/type/splunk_server.rb index ece5b5c1..1367ff9d 100644 --- a/lib/puppet/type/splunk_server.rb +++ b/lib/puppet/type/splunk_server.rb @@ -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 diff --git a/lib/puppet/type/splunk_serverclass.rb b/lib/puppet/type/splunk_serverclass.rb index 0b58cd58..b91dbd0d 100644 --- a/lib/puppet/type/splunk_serverclass.rb +++ b/lib/puppet/type/splunk_serverclass.rb @@ -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 diff --git a/lib/puppet/type/splunk_transforms.rb b/lib/puppet/type/splunk_transforms.rb index 6a1f01a8..62fdeb67 100644 --- a/lib/puppet/type/splunk_transforms.rb +++ b/lib/puppet/type/splunk_transforms.rb @@ -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 diff --git a/lib/puppet/type/splunk_uiprefs.rb b/lib/puppet/type/splunk_uiprefs.rb index c8aa5e54..453abc5c 100644 --- a/lib/puppet/type/splunk_uiprefs.rb +++ b/lib/puppet/type/splunk_uiprefs.rb @@ -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 diff --git a/lib/puppet/type/splunk_web.rb b/lib/puppet/type/splunk_web.rb index 9d28a830..b4bdb365 100644 --- a/lib/puppet/type/splunk_web.rb +++ b/lib/puppet/type/splunk_web.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_deploymentclient.rb b/lib/puppet/type/splunkforwarder_deploymentclient.rb index 0893074d..f3e312cf 100644 --- a/lib/puppet/type/splunkforwarder_deploymentclient.rb +++ b/lib/puppet/type/splunkforwarder_deploymentclient.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_input.rb b/lib/puppet/type/splunkforwarder_input.rb index 2a6a1871..1bc4e243 100644 --- a/lib/puppet/type/splunkforwarder_input.rb +++ b/lib/puppet/type/splunkforwarder_input.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_limits.rb b/lib/puppet/type/splunkforwarder_limits.rb index 95371bf3..8721e4ea 100644 --- a/lib/puppet/type/splunkforwarder_limits.rb +++ b/lib/puppet/type/splunkforwarder_limits.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_output.rb b/lib/puppet/type/splunkforwarder_output.rb index 66e31f70..2d65c2d9 100644 --- a/lib/puppet/type/splunkforwarder_output.rb +++ b/lib/puppet/type/splunkforwarder_output.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_props.rb b/lib/puppet/type/splunkforwarder_props.rb index 60af3d23..b873ee5e 100644 --- a/lib/puppet/type/splunkforwarder_props.rb +++ b/lib/puppet/type/splunkforwarder_props.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_server.rb b/lib/puppet/type/splunkforwarder_server.rb index c643d608..d6b3ba78 100644 --- a/lib/puppet/type/splunkforwarder_server.rb +++ b/lib/puppet/type/splunkforwarder_server.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_transforms.rb b/lib/puppet/type/splunkforwarder_transforms.rb index 9cd72aa7..8e49a1c4 100644 --- a/lib/puppet/type/splunkforwarder_transforms.rb +++ b/lib/puppet/type/splunkforwarder_transforms.rb @@ -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 diff --git a/lib/puppet/type/splunkforwarder_web.rb b/lib/puppet/type/splunkforwarder_web.rb index e1632b11..97966459 100644 --- a/lib/puppet/type/splunkforwarder_web.rb +++ b/lib/puppet/type/splunkforwarder_web.rb @@ -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 diff --git a/lib/puppet_x/puppetlabs/splunk/type.rb b/lib/puppet_x/puppetlabs/splunk/type.rb index 506679f9..c1f3641c 100644 --- a/lib/puppet_x/puppetlabs/splunk/type.rb +++ b/lib/puppet_x/puppetlabs/splunk/type.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require File.join(File.dirname(__FILE__), '..', '..', 'voxpupuli/splunk/util') module PuppetX @@ -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 diff --git a/lib/puppet_x/voxpupuli/splunk/util.rb b/lib/puppet_x/voxpupuli/splunk/util.rb index 14d065c3..1d828877 100644 --- a/lib/puppet_x/voxpupuli/splunk/util.rb +++ b/lib/puppet_x/voxpupuli/splunk/util.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'openssl' require 'base64' @@ -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*') diff --git a/spec/acceptance/splunk_enterprise_spec.rb b/spec/acceptance/splunk_enterprise_spec.rb index 0c3e5158..66372b8d 100644 --- a/spec/acceptance/splunk_enterprise_spec.rb +++ b/spec/acceptance/splunk_enterprise_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'splunk enterprise class' do diff --git a/spec/acceptance/splunk_forwarder_spec.rb b/spec/acceptance/splunk_forwarder_spec.rb index a4911ceb..feff4e47 100644 --- a/spec/acceptance/splunk_forwarder_spec.rb +++ b/spec/acceptance/splunk_forwarder_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'splunk::forwarder class' do diff --git a/spec/classes/enterprise_spec.rb b/spec/classes/enterprise_spec.rb index bae00f19..b06e2fbd 100644 --- a/spec/classes/enterprise_spec.rb +++ b/spec/classes/enterprise_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' shared_examples_for 'splunk enterprise nix defaults' do diff --git a/spec/classes/forwarder_spec.rb b/spec/classes/forwarder_spec.rb index f8ce9c57..b51d6e32 100644 --- a/spec/classes/forwarder_spec.rb +++ b/spec/classes/forwarder_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' shared_examples_for 'splunk forwarder' do diff --git a/spec/classes/splunk_spec.rb b/spec/classes/splunk_spec.rb index c05c42c5..31ed175a 100644 --- a/spec/classes/splunk_spec.rb +++ b/spec/classes/splunk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'splunk' do diff --git a/spec/defines/addon_spec.rb b/spec/defines/addon_spec.rb index 6a5e48f5..5faa30c5 100644 --- a/spec/defines/addon_spec.rb +++ b/spec/defines/addon_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'splunk::addon' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 69c72a82..3f981eb8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,4 +18,4 @@ require 'splunk_data' -$LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/fixtures/modules/inifile/lib" diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 349400b2..707feaae 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'voxpupuli/acceptance/spec_helper_acceptance' require 'splunk_data' diff --git a/spec/splunk_data.rb b/spec/splunk_data.rb index 43de3d04..8f3711c4 100644 --- a/spec/splunk_data.rb +++ b/spec/splunk_data.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + SPLUNK_SERVER_TYPES = { splunk_alert_actions: 'alert_actions.conf', splunk_authentication: 'authentication.conf', diff --git a/spec/unit/facter/splunk_version_spec.rb b/spec/unit/facter/splunk_version_spec.rb index aabd8a69..a4634114 100644 --- a/spec/unit/facter/splunk_version_spec.rb +++ b/spec/unit/facter/splunk_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'splunk_version Fact' do diff --git a/spec/unit/facter/splunkforwarder_version_spec.rb b/spec/unit/facter/splunkforwarder_version_spec.rb index b3bc72a0..028196be 100644 --- a/spec/unit/facter/splunkforwarder_version_spec.rb +++ b/spec/unit/facter/splunkforwarder_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'splunkforwarder_version Fact' do diff --git a/spec/unit/puppet/type/splunk_config_spec.rb b/spec/unit/puppet/type/splunk_config_spec.rb index 5ebfdffd..f4621eb1 100644 --- a/spec/unit/puppet/type/splunk_config_spec.rb +++ b/spec/unit/puppet/type/splunk_config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:splunk_config) do diff --git a/spec/unit/puppet/type/splunk_types_spec.rb b/spec/unit/puppet/type/splunk_types_spec.rb index 2c861d0b..a5d62d2c 100644 --- a/spec/unit/puppet/type/splunk_types_spec.rb +++ b/spec/unit/puppet/type/splunk_types_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # The majority of splunk and splunkforwarder types are identical and inherit # the same functionality off ini_file, so we don't need individual tests for them diff --git a/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb b/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb index 46704891..b932b527 100644 --- a/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb +++ b/spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'puppet_x/voxpupuli/splunk/util' From e167472ff0be22401acfdf931797aebcd70b1e90 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 3 Jul 2022 13:02:05 +0300 Subject: [PATCH 07/21] Fix remaining rubocop offenses --- lib/puppet/type/splunk_config.rb | 2 + spec/classes/enterprise_spec.rb | 680 ++++++++++---------- spec/classes/forwarder_spec.rb | 428 ++++++------ spec/classes/splunk_spec.rb | 20 +- spec/defines/addon_spec.rb | 58 +- spec/unit/puppet/type/splunk_config_spec.rb | 2 +- 6 files changed, 591 insertions(+), 599 deletions(-) diff --git a/lib/puppet/type/splunk_config.rb b/lib/puppet/type/splunk_config.rb index f9ce37b9..3691b0a0 100644 --- a/lib/puppet/type/splunk_config.rb +++ b/lib/puppet/type/splunk_config.rb @@ -10,6 +10,7 @@ desc 'splunk config' end + # rubocop:disable Lint/EmptyBlock newparam(:forwarder_installdir) do end @@ -21,6 +22,7 @@ newparam(:server_confdir) do end + # rubocop:enable Lint/EmptyBlock ## Generate purge parameters for the splunk_config type %i[ diff --git a/spec/classes/enterprise_spec.rb b/spec/classes/enterprise_spec.rb index b06e2fbd..7bd12ef2 100644 --- a/spec/classes/enterprise_spec.rb +++ b/spec/classes/enterprise_spec.rb @@ -41,366 +41,364 @@ describe 'splunk::enterprise' do context 'supported operating systems' do on_supported_os.each do |os, facts| - if os.start_with?('windows') - # Splunk Server not used supported on windows - else - context "on #{os}" do - let(:facts) do - facts + next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows + + context "on #{os}" do + let(:facts) do + facts + end + + context 'splunk when including forwarder and enterprise' do + let(:pre_condition) do + 'include splunk::forwarder' end - context 'splunk when including forwarder and enterprise' do - let(:pre_condition) do - 'include splunk::forwarder' - end + it { is_expected.to compile.and_raise_error(%r{Do not include splunk::forwarder on the same node as splunk::enterprise}) } + end + + context 'when manage_password = true' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + let(:params) { { 'manage_password' => true } } - it { is_expected.to compile.and_raise_error(%r{Do not include splunk::forwarder on the same node as splunk::enterprise}) } + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_file('/opt/splunk/etc/splunk.secret') } + it { is_expected.to contain_file('/opt/splunk/etc/passwd') } end + end - context 'when manage_password = true' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - let(:params) { { 'manage_password' => true } } + context 'when package_provider = yum' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + let(:params) { { 'package_provider' => 'yum' } } - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_file('/opt/splunk/etc/splunk.secret') } - it { is_expected.to contain_file('/opt/splunk/etc/passwd') } - end + it { is_expected.to contain_package('splunk').with(provider: 'yum') } end + end - context 'when package_provider = yum' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - let(:params) { { 'package_provider' => 'yum' } } + context 'with $boot_start = true (defaults)' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2' }" + end - it { is_expected.to contain_package('splunk').with(provider: 'yum') } + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } end - end - context 'with $boot_start = true (defaults)' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2' }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0' }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2' }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } - it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -systemd-managed 1 --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('Splunkd').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } - it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -systemd-managed 1 --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('Splunkd').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and user != root' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2' }" - end - let(:params) { { splunk_user: 'splunk' } } - - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user splunk -systemd-managed 1 --accept-license --answer-yes --no-prompt') } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0' }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunk') } - it { is_expected.not_to contain_exec('license_splunk') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', manage_net_tools => false }" end + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } end + + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0' }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2' }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } + it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('Splunkd').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } + it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('Splunkd').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and user != root' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2' }" + end + let(:params) { { splunk_user: 'splunk' } } + + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user splunk -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0' }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.to contain_exec('stop_splunk').with(command: '/opt/splunk/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunk').with(command: '/opt/splunk/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunk') } + it { is_expected.not_to contain_exec('license_splunk') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + end + end + + context 'with $boot_start = false' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', boot_start => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', boot_start => false, manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end - context 'with $boot_start = false' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', boot_start => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', boot_start => false, manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false, manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', boot_start => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } - it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('Splunkd').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.4.2', boot_start => false, manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } - it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('Splunkd').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } - end - - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2 and manage_net_tools == false' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false, manage_net_tools => false }" - end - - it_behaves_like 'splunk enterprise nix defaults' - it { is_expected.not_to contain_package('net-tools') } - it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } - it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } - it { is_expected.not_to contain_exec('stop_splunk') } - it { is_expected.not_to contain_exec('enable_splunk') } - it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false, manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', boot_start => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } + it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('Splunkd').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.4.2', boot_start => false, manage_net_tools => false }" end + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'Splunkd') } + it { is_expected.to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('Splunkd').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } end + + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools').with(ensure: 'installed') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2 and manage_net_tools == false' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false, manage_net_tools => false }" + end + + it_behaves_like 'splunk enterprise nix defaults' + it { is_expected.not_to contain_package('net-tools') } + it { is_expected.to contain_class('splunk::enterprise').with(service_name: 'splunk') } + it { is_expected.not_to contain_file('/etc/init.d/splunk').with(ensure: 'absent') } + it { is_expected.not_to contain_exec('stop_splunk') } + it { is_expected.not_to contain_exec('enable_splunk') } + it { is_expected.to contain_exec('disable_splunk').with(command: '/opt/splunk/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunk').with(command: '/opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunk/bin/splunk status'") } + end + end end end diff --git a/spec/classes/forwarder_spec.rb b/spec/classes/forwarder_spec.rb index b51d6e32..fe763296 100644 --- a/spec/classes/forwarder_spec.rb +++ b/spec/classes/forwarder_spec.rb @@ -29,260 +29,258 @@ describe 'splunk::forwarder' do context 'supported operating systems' do on_supported_os.each do |os, facts| - if os.start_with?('windows') - # Splunk Server not used supported on windows - else - context "on #{os}" do - let(:facts) do - facts - end + next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows - context 'splunk when including forwarder and enterprise' do - let(:pre_condition) do - 'include splunk::enterprise' - end + context "on #{os}" do + let(:facts) do + facts + end - it { is_expected.to compile.and_raise_error(%r{Do not include splunk::forwarder on the same node as splunk::enterprise}) } + context 'splunk when including forwarder and enterprise' do + let(:pre_condition) do + 'include splunk::enterprise' end - context 'when manage_password = true' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - let(:params) { { 'manage_password' => true } } + it { is_expected.to compile.and_raise_error(%r{Do not include splunk::forwarder on the same node as splunk::enterprise}) } + end + + context 'when manage_password = true' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + let(:params) { { 'manage_password' => true } } - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_file('/opt/splunkforwarder/etc/splunk.secret') } - it { is_expected.to contain_file('/opt/splunkforwarder/etc/passwd') } - end + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_file('/opt/splunkforwarder/etc/splunk.secret') } + it { is_expected.to contain_file('/opt/splunkforwarder/etc/passwd') } end + end - context 'when package_provider = yum' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - let(:params) { { 'package_provider' => 'yum' } } + context 'when package_provider = yum' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + let(:params) { { 'package_provider' => 'yum' } } - it { is_expected.to contain_package('splunkforwarder').with(provider: 'yum') } - end + it { is_expected.to contain_package('splunkforwarder').with(provider: 'yum') } end + end + + context 'with $boot_start = true (defaults)' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - context 'with $boot_start = true (defaults)' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2' }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunkforwarder') } - it { is_expected.not_to contain_exec('license_splunkforwarder') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2' }" + end + + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunkforwarder') } + it { is_expected.not_to contain_exec('license_splunkforwarder') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0' }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunkforwarder') } - it { is_expected.not_to contain_exec('license_splunkforwarder') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0' }" end - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2' }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'SplunkForwarder') } - it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root -systemd-managed 1 --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunkforwarder') } - it { is_expected.not_to contain_exec('license_splunkforwarder') } - it { is_expected.to contain_service('SplunkForwarder').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunkforwarder') } + it { is_expected.not_to contain_exec('license_splunkforwarder') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2' }" end - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and user != root' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2' }" - end - let(:params) { { splunk_user: 'splunk' } } + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'SplunkForwarder') } + it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunkforwarder') } + it { is_expected.not_to contain_exec('license_splunkforwarder') } + it { is_expected.to contain_service('SplunkForwarder').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + end - it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user splunk -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2 and user != root' do + let(:facts) do + facts.merge(service_provider: 'systemd') end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2' }" + end + let(:params) { { splunk_user: 'splunk' } } + + it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user splunk -systemd-managed 1 --accept-license --answer-yes --no-prompt') } + end - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0' }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } - it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.not_to contain_exec('disable_splunkforwarder') } - it { is_expected.not_to contain_exec('license_splunkforwarder') } - it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0' }" end + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.to contain_exec('stop_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk stop') } + it { is_expected.to contain_exec('enable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk enable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.not_to contain_exec('disable_splunkforwarder') } + it { is_expected.not_to contain_exec('license_splunkforwarder') } + it { is_expected.to contain_service('splunk').with(ensure: 'running', enable: true, status: nil, restart: nil, start: nil, stop: nil) } end + end + end - context 'with $boot_start = false' do - if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' - - context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2', boot_start => false }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.not_to contain_exec('stop_splunkforwarder') } - it { is_expected.not_to contain_exec('enable_splunkforwarder') } - it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + context 'with $boot_start = false' do + if facts[:kernel] == 'Linux' || facts[:kernel] == 'SunOS' + + context 'with $facts[service_provider] == init and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2', boot_start => false }" end - context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'init') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.not_to contain_exec('stop_splunkforwarder') } - it { is_expected.not_to contain_exec('enable_splunkforwarder') } - it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.not_to contain_exec('stop_splunkforwarder') } + it { is_expected.not_to contain_exec('enable_splunkforwarder') } + it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + end + + context 'with $facts[service_provider] == init and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'init') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false }" end - context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2', boot_start => false }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'SplunkForwarder') } - it { is_expected.not_to contain_exec('stop_splunkforwarder') } - it { is_expected.not_to contain_exec('enable_splunkforwarder') } - it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('SplunkForwarder').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.not_to contain_exec('stop_splunkforwarder') } + it { is_expected.not_to contain_exec('enable_splunkforwarder') } + it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + end + + context 'with $facts[service_provider] == systemd and $splunk::params::version >= 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2', boot_start => false }" + end + + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'SplunkForwarder') } + it { is_expected.not_to contain_exec('stop_splunkforwarder') } + it { is_expected.not_to contain_exec('enable_splunkforwarder') } + it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('SplunkForwarder').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + end - context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do - let(:facts) do - facts.merge(service_provider: 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '6.0.0', boot_start => false }" - end - - it_behaves_like 'splunk forwarder' - it { is_expected.to contain_class('splunk::forwarder::service::nix') } - it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } - it { is_expected.not_to contain_exec('stop_splunkforwarder') } - it { is_expected.not_to contain_exec('enable_splunkforwarder') } - it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } - it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } + context 'with $facts[service_provider] == systemd and $splunk::params::version < 7.2.2' do + let(:facts) do + facts.merge(service_provider: 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '6.0.0', boot_start => false }" end + it_behaves_like 'splunk forwarder' + it { is_expected.to contain_class('splunk::forwarder::service::nix') } + it { is_expected.to contain_class('splunk::forwarder').with(service_name: 'splunk') } + it { is_expected.not_to contain_exec('stop_splunkforwarder') } + it { is_expected.not_to contain_exec('enable_splunkforwarder') } + it { is_expected.to contain_exec('disable_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk disable boot-start -user root --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_exec('license_splunkforwarder').with(command: '/opt/splunkforwarder/bin/splunk ftr --accept-license --answer-yes --no-prompt') } + it { is_expected.to contain_service('splunk').with(restart: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk restart'", start: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk start'", stop: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk stop'", status: "/usr/sbin/runuser -l root -c '/opt/splunkforwarder/bin/splunk status'") } end + end + end - context 'when forwarder not already installed' do - let(:facts) do - facts.merge(splunkforwarder_version: nil, service_provider: facts[:kernel] == 'FreeBSD' ? 'freebsd' : 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2' }" - end - let(:accept_tos_command) do - '/opt/splunkforwarder/bin/splunk stop && /opt/splunkforwarder/bin/splunk start --accept-license --answer-yes && /opt/splunkforwarder/bin/splunk stop' - end - let(:service_name) do - facts[:kernel] == 'FreeBSD' ? 'splunk' : 'SplunkForwarder' - end + context 'when forwarder not already installed' do + let(:facts) do + facts.merge(splunkforwarder_version: nil, service_provider: facts[:kernel] == 'FreeBSD' ? 'freebsd' : 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2' }" + end + let(:accept_tos_command) do + '/opt/splunkforwarder/bin/splunk stop && /opt/splunkforwarder/bin/splunk start --accept-license --answer-yes && /opt/splunkforwarder/bin/splunk stop' + end + let(:service_name) do + facts[:kernel] == 'FreeBSD' ? 'splunk' : 'SplunkForwarder' + end - it_behaves_like 'splunk forwarder' - it do - is_expected.to contain_exec('splunk-forwarder-accept-tos').with( - command: accept_tos_command, - user: 'root', - before: "Service[#{service_name}]", - subscribe: nil, - require: 'Exec[enable_splunkforwarder]', - refreshonly: 'true' - ) - end + it_behaves_like 'splunk forwarder' + it do + is_expected.to contain_exec('splunk-forwarder-accept-tos').with( + command: accept_tos_command, + user: 'root', + before: "Service[#{service_name}]", + subscribe: nil, + require: 'Exec[enable_splunkforwarder]', + refreshonly: 'true' + ) end + end - context 'when forwarder already installed' do - let(:facts) do - facts.merge(splunkforwarder_version: '7.3.3', service_provider: facts[:kernel] == 'FreeBSD' ? 'freebsd' : 'systemd') - end - let(:pre_condition) do - "class { 'splunk::params': version => '7.2.2' }" - end - let(:accept_tos_command) do - '/opt/splunkforwarder/bin/splunk stop && /opt/splunkforwarder/bin/splunk start --accept-license --answer-yes && /opt/splunkforwarder/bin/splunk stop' - end - let(:service_name) do - facts[:kernel] == 'FreeBSD' ? 'splunk' : 'SplunkForwarder' - end + context 'when forwarder already installed' do + let(:facts) do + facts.merge(splunkforwarder_version: '7.3.3', service_provider: facts[:kernel] == 'FreeBSD' ? 'freebsd' : 'systemd') + end + let(:pre_condition) do + "class { 'splunk::params': version => '7.2.2' }" + end + let(:accept_tos_command) do + '/opt/splunkforwarder/bin/splunk stop && /opt/splunkforwarder/bin/splunk start --accept-license --answer-yes && /opt/splunkforwarder/bin/splunk stop' + end + let(:service_name) do + facts[:kernel] == 'FreeBSD' ? 'splunk' : 'SplunkForwarder' + end - it_behaves_like 'splunk forwarder' - it do - is_expected.to contain_exec('splunk-forwarder-accept-tos').with( - command: accept_tos_command, - user: 'root', - before: "Service[#{service_name}]", - subscribe: 'Package[splunkforwarder]', - require: 'Exec[enable_splunkforwarder]', - refreshonly: 'true' - ) - end + it_behaves_like 'splunk forwarder' + it do + is_expected.to contain_exec('splunk-forwarder-accept-tos').with( + command: accept_tos_command, + user: 'root', + before: "Service[#{service_name}]", + subscribe: 'Package[splunkforwarder]', + require: 'Exec[enable_splunkforwarder]', + refreshonly: 'true' + ) end context 'when $splunk::params::manage_net_tools == false' do diff --git a/spec/classes/splunk_spec.rb b/spec/classes/splunk_spec.rb index 31ed175a..b3630eae 100644 --- a/spec/classes/splunk_spec.rb +++ b/spec/classes/splunk_spec.rb @@ -5,18 +5,16 @@ describe 'splunk' do context 'supported operating systems' do on_supported_os.each do |os, facts| - if os.start_with?('windows') - # Splunk Server not used supported on windows - else - context "on #{os}" do - let(:facts) do - facts - end + next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows - context 'splunk class without any parameters' do - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('splunk') } - end + context "on #{os}" do + let(:facts) do + facts + end + + context 'splunk class without any parameters' do + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('splunk') } end end end diff --git a/spec/defines/addon_spec.rb b/spec/defines/addon_spec.rb index 5faa30c5..631b9b27 100644 --- a/spec/defines/addon_spec.rb +++ b/spec/defines/addon_spec.rb @@ -5,18 +5,16 @@ describe 'splunk::addon' do context 'fail if class prerequisit not declared' do on_supported_os.each do |os, facts| - if os.start_with?('windows') - # Splunk Server not used supported on windows - else - context "on #{os}" do - let(:facts) do - facts - end - let(:title) { 'Splunk_TA' } - let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } } + next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows - it { is_expected.to compile.and_raise_error(%r{Error while evaluating a Function Call}) } + context "on #{os}" do + let(:facts) do + facts end + let(:title) { 'Splunk_TA' } + let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } } + + it { is_expected.to compile.and_raise_error(%r{Error while evaluating a Function Call}) } end end end @@ -27,32 +25,30 @@ end on_supported_os.each do |os, facts| - if os.start_with?('windows') - # Splunk Server not used supported on windows - else - context "on #{os}" do - let(:facts) do - facts - end + next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows - context 'basic addon' do - let(:title) { 'Splunk_TA' } - let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } } + context "on #{os}" do + let(:facts) do + facts + end - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.tgz') } - end + context 'basic addon' do + let(:title) { 'Splunk_TA' } + let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } } - context 'addon requiring extract_command' do - let(:title) { 'Splunk_TA' } - let(:params) do - { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.spl', - 'extract_command' => 'tar zxf %s' } - end + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.tgz') } + end - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.spl', extract_command: 'tar zxf %s') } + context 'addon requiring extract_command' do + let(:title) { 'Splunk_TA' } + let(:params) do + { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.spl', + 'extract_command' => 'tar zxf %s' } end + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.spl', extract_command: 'tar zxf %s') } end end end diff --git a/spec/unit/puppet/type/splunk_config_spec.rb b/spec/unit/puppet/type/splunk_config_spec.rb index f4621eb1..a19f6bc7 100644 --- a/spec/unit/puppet/type/splunk_config_spec.rb +++ b/spec/unit/puppet/type/splunk_config_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Puppet::Type.type(:splunk_config) do - let(:subject) do + let(:subject) do # rubocop:disable RSpec/SubjectDeclaration described_class.new( name: 'config', server_confdir: '/opt/splunk/etc', From c58c718f1cb7d89d378601e548568d1cd4fe35df Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 18:15:03 +0200 Subject: [PATCH 08/21] modulesync 5.3.0 --- Rakefile | 2 +- spec/spec_helper.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index f92f0516..763a6f7a 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,7 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' - config.project = metadata.metadata['name'] + config.project = 'puppet-splunk' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f981eb8..55d5a336 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| @@ -16,6 +18,6 @@ end end -require 'splunk_data' +require 'splunk_data.rb' -$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/fixtures/modules/inifile/lib" +$LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' From d35060ab7eff8ea168fbd43bcf5245bc849cb0dd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 17:16:39 +0100 Subject: [PATCH 09/21] modulesync 5.4.0 --- .msync.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 02353859..f3156d15 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.3.0' +modulesync_config_version: '5.4.0' diff --git a/Gemfile b/Gemfile index 07209b79..b3827ba7 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 2.0', :require => false end group :development do From ac5d29cab5a64473109f1ee67506b7ceeaf10399 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 10:34:46 +0200 Subject: [PATCH 10/21] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf22..00000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224c..84fd904c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile diff --git a/.msync.yml b/.msync.yml index f3156d15..a4b00691 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f50514..58a04088 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile diff --git a/Gemfile b/Gemfile index b3827ba7..15313c38 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index 763a6f7a..10e26e73 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-splunk' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = 'voxpupuli' - config.project = 'puppet-splunk' - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby From 9da565f9ce4f5727aa8dff9e2d581b7ac716c11a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 13:52:49 +0200 Subject: [PATCH 11/21] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b00691..b929160c 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 15313c38..98a04cfb 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false end group :development do @@ -16,18 +16,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From be1c794649a50442706b3008c3fed086c8450047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 27 Jun 2023 12:37:00 -1000 Subject: [PATCH 12/21] Regenerate REFERENCE.md --- REFERENCE.md | 862 +++++++++++++++++++++++++-------------------------- 1 file changed, 430 insertions(+), 432 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index f16a13fd..ffec7499 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -8,50 +8,50 @@ * [`splunk`](#splunk): This class is unused and doesn't do anything but make default data accessible -* [`splunk::enterprise`](#splunkenterprise): Install and configure an instance of Splunk Enterprise -* [`splunk::enterprise::config`](#splunkenterpriseconfig): Private class declared by Class[splunk::enterprise] to contain all the +* [`splunk::enterprise`](#splunk--enterprise): Install and configure an instance of Splunk Enterprise +* [`splunk::enterprise::config`](#splunk--enterprise--config): Private class declared by Class[splunk::enterprise] to contain all the configuration needed for a base install of Splunk Enterprise -* [`splunk::enterprise::install`](#splunkenterpriseinstall): Private class declared by Class[splunk::enterprise] to contain or define +* [`splunk::enterprise::install`](#splunk--enterprise--install): Private class declared by Class[splunk::enterprise] to contain or define through additional platform specific sub-class, the required steps for successfully installing Splunk Enterprise -* [`splunk::enterprise::install::nix`](#splunkenterpriseinstallnix): Private class declared by Class[splunk::enterprise::install] to provide +* [`splunk::enterprise::install::nix`](#splunk--enterprise--install--nix): Private class declared by Class[splunk::enterprise::install] to provide platform specific installation steps on Linux or Unix type systems. -* [`splunk::enterprise::password::manage`](#splunkenterprisepasswordmanage): Implements the direct management of the Splunk Enterprise admin password +* [`splunk::enterprise::password::manage`](#splunk--enterprise--password--manage): Implements the direct management of the Splunk Enterprise admin password so it can be used outside of regular management of the whole stack to facilitate admin password resets through Bolt Plans. Note: Entirely done to make this implementation consistent with the method used to manage admin password seeding. -* [`splunk::enterprise::password::seed`](#splunkenterprisepasswordseed): Implements the seeding and reseeding of the Splunk Enterprise admin password +* [`splunk::enterprise::password::seed`](#splunk--enterprise--password--seed): Implements the seeding and reseeding of the Splunk Enterprise admin password so it can be used outside of regular management of the whole stack to facilitate admin password resets through Bolt Plans -* [`splunk::enterprise::service`](#splunkenterpriseservice): Private class declared by Class[splunk::enterprise] to define a service +* [`splunk::enterprise::service`](#splunk--enterprise--service): Private class declared by Class[splunk::enterprise] to define a service as its understood by Puppet using a dynamic set of data or platform specific sub-classes -* [`splunk::enterprise::service::nix`](#splunkenterpriseservicenix): Private class declared by Class[splunk::enterprise::service] to provide +* [`splunk::enterprise::service::nix`](#splunk--enterprise--service--nix): Private class declared by Class[splunk::enterprise::service] to provide platform specific service management on Linux or Unix type systems. -* [`splunk::forwarder`](#splunkforwarder): Install and configure an instance of Splunk Universal Forwarder -* [`splunk::forwarder::config`](#splunkforwarderconfig): Private class declared by Class[splunk::forwarder] to contain all the +* [`splunk::forwarder`](#splunk--forwarder): Install and configure an instance of Splunk Universal Forwarder +* [`splunk::forwarder::config`](#splunk--forwarder--config): Private class declared by Class[splunk::forwarder] to contain all the configuration needed for a base install of the Splunk Universal Forwarder -* [`splunk::forwarder::install`](#splunkforwarderinstall): Private class declared by Class[splunk::forwarder] to contain or define +* [`splunk::forwarder::install`](#splunk--forwarder--install): Private class declared by Class[splunk::forwarder] to contain or define through additional platform specific sub-class, the required steps for successfully installing the Splunk Universal Forwarder -* [`splunk::forwarder::password::manage`](#splunkforwarderpasswordmanage): Implements the direct management of the Splunk Forwarder admin password +* [`splunk::forwarder::password::manage`](#splunk--forwarder--password--manage): Implements the direct management of the Splunk Forwarder admin password so it can be used outside of regular management of the whole stack to facilitate admin password resets through Bolt Plans. Note: Entirely done to make this implementation consistent with the method used to manage admin password seeding. -* [`splunk::forwarder::password::seed`](#splunkforwarderpasswordseed): Implements the seeding and reseeding of the Splunk Forwarder admin password +* [`splunk::forwarder::password::seed`](#splunk--forwarder--password--seed): Implements the seeding and reseeding of the Splunk Forwarder admin password so it can be used outside of regular management of the whole stack to facilitate admin password resets through Bolt Plans -* [`splunk::forwarder::service`](#splunkforwarderservice): Private class declared by Class[splunk::forwarder] to define a service as +* [`splunk::forwarder::service`](#splunk--forwarder--service): Private class declared by Class[splunk::forwarder] to define a service as its understood by Puppet using a dynamic set of data or platform specific sub-classes -* [`splunk::forwarder::service::nix`](#splunkforwarderservicenix): Private class declared by Class[splunk::forwarder::service] to provide +* [`splunk::forwarder::service::nix`](#splunk--forwarder--service--nix): Private class declared by Class[splunk::forwarder::service] to provide platform specific service management on Linux or Unix type systems. -* [`splunk::params`](#splunkparams): This class takes a small number of arguments (can be set through Hiera) and +* [`splunk::params`](#splunk--params): This class takes a small number of arguments (can be set through Hiera) and generates sane default values installation media names and locations. Default ports can also be specified here. This is a parameters class, and contributes no resources to the graph. Rather, it only sets values for @@ -59,7 +59,7 @@ parameters to be consumed by child classes. ### Defined types -* [`splunk::addon`](#splunkaddon): Defined type for deploying Splunk Add-ons and Apps from either OS packages +* [`splunk::addon`](#splunk--addon): Defined type for deploying Splunk Add-ons and Apps from either OS packages or via splunkbase compatible archives ### Resource types @@ -92,8 +92,8 @@ or via splunkbase compatible archives ### Data types -* [`Splunk::Entinstalloptions`](#splunkentinstalloptions) -* [`Splunk::Fwdinstalloptions`](#splunkfwdinstalloptions) +* [`Splunk::Entinstalloptions`](#Splunk--Entinstalloptions) +* [`Splunk::Fwdinstalloptions`](#Splunk--Fwdinstalloptions) ## Classes @@ -105,7 +105,7 @@ accessible * **Note** If you were expecting this class to setup an instance of Splunk Enterprise then please look to Class[splunk::enterprise]. -### `splunk::enterprise` +### `splunk::enterprise` Install and configure an instance of Splunk Enterprise @@ -134,56 +134,56 @@ class { 'splunk::enterprise': The following parameters are available in the `splunk::enterprise` class: -* [`version`](#version) -* [`package_name`](#package_name) -* [`package_ensure`](#package_ensure) -* [`staging_dir`](#staging_dir) -* [`path_delimiter`](#path_delimiter) -* [`enterprise_package_src`](#enterprise_package_src) -* [`package_provider`](#package_provider) -* [`manage_package_source`](#manage_package_source) -* [`package_source`](#package_source) -* [`install_options`](#install_options) -* [`splunk_user`](#splunk_user) -* [`enterprise_homedir`](#enterprise_homedir) -* [`enterprise_confdir`](#enterprise_confdir) -* [`service_name`](#service_name) -* [`service_file`](#service_file) -* [`boot_start`](#boot_start) -* [`use_default_config`](#use_default_config) -* [`input_default_host`](#input_default_host) -* [`input_connection_host`](#input_connection_host) -* [`splunkd_listen`](#splunkd_listen) -* [`logging_port`](#logging_port) -* [`splunkd_port`](#splunkd_port) -* [`web_httpport`](#web_httpport) -* [`purge_inputs`](#purge_inputs) -* [`purge_outputs`](#purge_outputs) -* [`purge_authentication`](#purge_authentication) -* [`purge_authorize`](#purge_authorize) -* [`purge_distsearch`](#purge_distsearch) -* [`purge_indexes`](#purge_indexes) -* [`purge_limits`](#purge_limits) -* [`purge_props`](#purge_props) -* [`purge_server`](#purge_server) -* [`purge_transforms`](#purge_transforms) -* [`purge_web`](#purge_web) -* [`manage_password`](#manage_password) -* [`seed_password`](#seed_password) -* [`reset_seeded_password`](#reset_seeded_password) -* [`password_config_file`](#password_config_file) -* [`seed_config_file`](#seed_config_file) -* [`seed_user`](#seed_user) -* [`password_content`](#password_content) -* [`password_hash`](#password_hash) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`purge_alert_actions`](#purge_alert_actions) -* [`purge_deploymentclient`](#purge_deploymentclient) -* [`purge_serverclass`](#purge_serverclass) -* [`purge_uiprefs`](#purge_uiprefs) - -##### `version` +* [`version`](#-splunk--enterprise--version) +* [`package_name`](#-splunk--enterprise--package_name) +* [`package_ensure`](#-splunk--enterprise--package_ensure) +* [`staging_dir`](#-splunk--enterprise--staging_dir) +* [`path_delimiter`](#-splunk--enterprise--path_delimiter) +* [`enterprise_package_src`](#-splunk--enterprise--enterprise_package_src) +* [`package_provider`](#-splunk--enterprise--package_provider) +* [`manage_package_source`](#-splunk--enterprise--manage_package_source) +* [`package_source`](#-splunk--enterprise--package_source) +* [`install_options`](#-splunk--enterprise--install_options) +* [`splunk_user`](#-splunk--enterprise--splunk_user) +* [`enterprise_homedir`](#-splunk--enterprise--enterprise_homedir) +* [`enterprise_confdir`](#-splunk--enterprise--enterprise_confdir) +* [`service_name`](#-splunk--enterprise--service_name) +* [`service_file`](#-splunk--enterprise--service_file) +* [`boot_start`](#-splunk--enterprise--boot_start) +* [`use_default_config`](#-splunk--enterprise--use_default_config) +* [`input_default_host`](#-splunk--enterprise--input_default_host) +* [`input_connection_host`](#-splunk--enterprise--input_connection_host) +* [`splunkd_listen`](#-splunk--enterprise--splunkd_listen) +* [`logging_port`](#-splunk--enterprise--logging_port) +* [`splunkd_port`](#-splunk--enterprise--splunkd_port) +* [`web_httpport`](#-splunk--enterprise--web_httpport) +* [`purge_inputs`](#-splunk--enterprise--purge_inputs) +* [`purge_outputs`](#-splunk--enterprise--purge_outputs) +* [`purge_authentication`](#-splunk--enterprise--purge_authentication) +* [`purge_authorize`](#-splunk--enterprise--purge_authorize) +* [`purge_distsearch`](#-splunk--enterprise--purge_distsearch) +* [`purge_indexes`](#-splunk--enterprise--purge_indexes) +* [`purge_limits`](#-splunk--enterprise--purge_limits) +* [`purge_props`](#-splunk--enterprise--purge_props) +* [`purge_server`](#-splunk--enterprise--purge_server) +* [`purge_transforms`](#-splunk--enterprise--purge_transforms) +* [`purge_web`](#-splunk--enterprise--purge_web) +* [`manage_password`](#-splunk--enterprise--manage_password) +* [`seed_password`](#-splunk--enterprise--seed_password) +* [`reset_seeded_password`](#-splunk--enterprise--reset_seeded_password) +* [`password_config_file`](#-splunk--enterprise--password_config_file) +* [`seed_config_file`](#-splunk--enterprise--seed_config_file) +* [`seed_user`](#-splunk--enterprise--seed_user) +* [`password_content`](#-splunk--enterprise--password_content) +* [`password_hash`](#-splunk--enterprise--password_hash) +* [`secret_file`](#-splunk--enterprise--secret_file) +* [`secret`](#-splunk--enterprise--secret) +* [`purge_alert_actions`](#-splunk--enterprise--purge_alert_actions) +* [`purge_deploymentclient`](#-splunk--enterprise--purge_deploymentclient) +* [`purge_serverclass`](#-splunk--enterprise--purge_serverclass) +* [`purge_uiprefs`](#-splunk--enterprise--purge_uiprefs) + +##### `version` Data type: `String[1]` @@ -192,7 +192,7 @@ manage. Default value: `$splunk::params::version` -##### `package_name` +##### `package_name` Data type: `String[1]` @@ -200,7 +200,7 @@ The name of the package(s) Puppet will use to install Splunk. Default value: `$splunk::params::enterprise_package_name` -##### `package_ensure` +##### `package_ensure` Data type: `String[1]` @@ -208,7 +208,7 @@ Ensure parameter which will get passed to the Splunk package resource. Default value: `$splunk::params::enterprise_package_ensure` -##### `staging_dir` +##### `staging_dir` Data type: `String[1]` @@ -216,7 +216,7 @@ Root of the archive path to host the Splunk package. Default value: `$splunk::params::staging_dir` -##### `path_delimiter` +##### `path_delimiter` Data type: `String[1]` @@ -224,7 +224,7 @@ The path separator used in the archived path of the Splunk package. Default value: `$splunk::params::path_delimiter` -##### `enterprise_package_src` +##### `enterprise_package_src` Data type: `String[1]` @@ -236,7 +236,7 @@ a UNC path to the MSI. Default value: `$splunk::params::enterprise_package_src` -##### `package_provider` +##### `package_provider` Data type: `Optional[String[1]]` @@ -244,15 +244,15 @@ The package management system used to host the Splunk packages. Default value: `$splunk::params::package_provider` -##### `manage_package_source` +##### `manage_package_source` Data type: `Boolean` Whether or not to use the supplied `enterprise_package_src` param. -Default value: ``true`` +Default value: `true` -##### `package_source` +##### `package_source` Data type: `Optional[String[1]]` @@ -262,9 +262,9 @@ MSI, etc). If `enterprise_package_src` parameter is set in splunk::params and it is required. The URL can be of any protocol supported by the puppet/archive module. On Windows, this can be a UNC path to the MSI. -Default value: ``undef`` +Default value: `undef` -##### `install_options` +##### `install_options` Data type: `Splunk::Entinstalloptions` @@ -272,7 +272,7 @@ This variable is passed to the package resources' *install_options* parameter. Default value: `$splunk::params::enterprise_install_options` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -280,7 +280,7 @@ The user to run Splunk as. Default value: `$splunk::params::splunk_user` -##### `enterprise_homedir` +##### `enterprise_homedir` Data type: `Stdlib::Absolutepath` @@ -288,7 +288,7 @@ Specifies the Splunk Enterprise home directory. Default value: `$splunk::params::enterprise_homedir` -##### `enterprise_confdir` +##### `enterprise_confdir` Data type: `Stdlib::Absolutepath` @@ -296,7 +296,7 @@ Specifies the Splunk Enterprise configuration directory. Default value: `$splunk::params::enterprise_confdir` -##### `service_name` +##### `service_name` Data type: `String[1]` @@ -304,7 +304,7 @@ The name of the Splunk Enterprise service. Default value: `$splunk::params::enterprise_service` -##### `service_file` +##### `service_file` Data type: `Stdlib::Absolutepath` @@ -312,7 +312,7 @@ The path to the Splunk Enterprise service file. Default value: `$splunk::params::enterprise_service_file` -##### `boot_start` +##### `boot_start` Data type: `Boolean` @@ -321,16 +321,16 @@ manage the Splunk Enterprise service. Default value: `$splunk::params::boot_start` -##### `use_default_config` +##### `use_default_config` Data type: `Boolean` Whether or not the module should manage a default set of Splunk Enterprise configuration parameters. -Default value: ``true`` +Default value: `true` -##### `input_default_host` +##### `input_default_host` Data type: `String[1]` @@ -338,7 +338,7 @@ Part of the default config. Sets the `splunk_input` default host. Default value: `$facts['networking']['fqdn']` -##### `input_connection_host` +##### `input_connection_host` Data type: `String[1]` @@ -346,7 +346,7 @@ Part of the default config. Sets the `splunk_input` connection host. Default value: `'dns'` -##### `splunkd_listen` +##### `splunkd_listen` Data type: `Stdlib::IP::Address` @@ -354,7 +354,7 @@ The address on which splunkd should listen. Default value: `'127.0.0.1'` -##### `logging_port` +##### `logging_port` Data type: `Stdlib::Port` @@ -362,7 +362,7 @@ The port to receive TCP logs on. Default value: `$splunk::params::logging_port` -##### `splunkd_port` +##### `splunkd_port` Data type: `Stdlib::Port` @@ -370,7 +370,7 @@ The management port for Splunk. Default value: `$splunk::params::splunkd_port` -##### `web_httpport` +##### `web_httpport` Data type: `Stdlib::Port` @@ -378,106 +378,106 @@ The port on which to service the Splunk Web interface. Default value: `8000` -##### `purge_inputs` +##### `purge_inputs` Data type: `Boolean` If set to true, inputs.conf will be purged of configuration that is no longer managed by the `splunk_input` type. -Default value: ``false`` +Default value: `false` -##### `purge_outputs` +##### `purge_outputs` Data type: `Boolean` If set to true, outputs.conf will be purged of configuration that is no longer managed by the `splunk_output` type. -Default value: ``false`` +Default value: `false` -##### `purge_authentication` +##### `purge_authentication` Data type: `Boolean` If set to true, authentication.conf will be purged of configuration that is no longer managed by the `splunk_authentication` type. -Default value: ``false`` +Default value: `false` -##### `purge_authorize` +##### `purge_authorize` Data type: `Boolean` If set to true, authorize.conf will be purged of configuration that is no longer managed by the `splunk_authorize` type. -Default value: ``false`` +Default value: `false` -##### `purge_distsearch` +##### `purge_distsearch` Data type: `Boolean` If set to true, distsearch.conf will be purged of configuration that is no longer managed by the `splunk_distsearch` type. -Default value: ``false`` +Default value: `false` -##### `purge_indexes` +##### `purge_indexes` Data type: `Boolean` If set to true, indexes.conf will be purged of configuration that is no longer managed by the `splunk_indexes` type. -Default value: ``false`` +Default value: `false` -##### `purge_limits` +##### `purge_limits` Data type: `Boolean` If set to true, limits.conf will be purged of configuration that is no longer managed by the `splunk_limits` type. -Default value: ``false`` +Default value: `false` -##### `purge_props` +##### `purge_props` Data type: `Boolean` If set to true, props.conf will be purged of configuration that is no longer managed by the `splunk_props` type. -Default value: ``false`` +Default value: `false` -##### `purge_server` +##### `purge_server` Data type: `Boolean` If set to true, server.conf will be purged of configuration that is no longer managed by the `splunk_server` type. -Default value: ``false`` +Default value: `false` -##### `purge_transforms` +##### `purge_transforms` Data type: `Boolean` If set to true, transforms.conf will be purged of configuration that is no longer managed by the `splunk_transforms` type. -Default value: ``false`` +Default value: `false` -##### `purge_web` +##### `purge_web` Data type: `Boolean` If set to true, web.conf will be purged of configuration that is no longer managed by the `splunk_web type`. -Default value: ``false`` +Default value: `false` -##### `manage_password` +##### `manage_password` Data type: `Boolean` @@ -485,7 +485,7 @@ If set to true, Manage the contents of splunk.secret and passwd. Default value: `$splunk::params::manage_password` -##### `seed_password` +##### `seed_password` Data type: `Boolean` @@ -493,7 +493,7 @@ If set to true, Manage the contents of splunk.secret and user-seed.conf. Default value: `$splunk::params::seed_password` -##### `reset_seeded_password` +##### `reset_seeded_password` Data type: `Boolean` @@ -502,7 +502,7 @@ import process on restart of the Splunk services. Default value: `$splunk::params::reset_seeded_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -511,7 +511,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::enterprise_password_config_file` -##### `seed_config_file` +##### `seed_config_file` Data type: `Stdlib::Absolutepath` @@ -520,7 +520,7 @@ restart. Default value: `$splunk::params::enterprise_seed_config_file` -##### `seed_user` +##### `seed_user` Data type: `String[1]` @@ -528,7 +528,7 @@ The local user (usually 'admin') imported by Splunk. Default value: `$splunk::params::seed_user` -##### `password_content` +##### `password_content` Data type: `String[1]` @@ -536,7 +536,7 @@ The hashed password username/details for the user. Default value: `$splunk::params::password_content` -##### `password_hash` +##### `password_hash` Data type: `String[1]` @@ -544,7 +544,7 @@ The hashed password for the admin user. Default value: `$splunk::params::password_hash` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -552,7 +552,7 @@ Which file we should put the secret in. Default value: `$splunk::params::enterprise_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -560,55 +560,55 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `purge_alert_actions` +##### `purge_alert_actions` Data type: `Boolean` -Default value: ``false`` +Default value: `false` -##### `purge_deploymentclient` +##### `purge_deploymentclient` Data type: `Boolean` -Default value: ``false`` +Default value: `false` -##### `purge_serverclass` +##### `purge_serverclass` Data type: `Boolean` -Default value: ``false`` +Default value: `false` -##### `purge_uiprefs` +##### `purge_uiprefs` Data type: `Boolean` -Default value: ``false`` +Default value: `false` -### `splunk::enterprise::config` +### `splunk::enterprise::config` Private class declared by Class[splunk::enterprise] to contain all the configuration needed for a base install of Splunk Enterprise -### `splunk::enterprise::install` +### `splunk::enterprise::install` Private class declared by Class[splunk::enterprise] to contain or define through additional platform specific sub-class, the required steps for successfully installing Splunk Enterprise -### `splunk::enterprise::install::nix` +### `splunk::enterprise::install::nix` Private class declared by Class[splunk::enterprise::install] to provide platform specific installation steps on Linux or Unix type systems. -### `splunk::enterprise::password::manage` +### `splunk::enterprise::password::manage` Implements the direct management of the Splunk Enterprise admin password so it can be used outside of regular management of the whole stack to @@ -621,16 +621,16 @@ used to manage admin password seeding. The following parameters are available in the `splunk::enterprise::password::manage` class: -* [`manage_password`](#manage_password) -* [`password_config_file`](#password_config_file) -* [`password_content`](#password_content) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`service`](#service) -* [`mode`](#mode) -* [`splunk_user`](#splunk_user) +* [`manage_password`](#-splunk--enterprise--password--manage--manage_password) +* [`password_config_file`](#-splunk--enterprise--password--manage--password_config_file) +* [`password_content`](#-splunk--enterprise--password--manage--password_content) +* [`secret_file`](#-splunk--enterprise--password--manage--secret_file) +* [`secret`](#-splunk--enterprise--password--manage--secret) +* [`service`](#-splunk--enterprise--password--manage--service) +* [`mode`](#-splunk--enterprise--password--manage--mode) +* [`splunk_user`](#-splunk--enterprise--password--manage--splunk_user) -##### `manage_password` +##### `manage_password` Data type: `Boolean` @@ -638,7 +638,7 @@ If set to true, Manage the contents of splunk.secret and passwd. Default value: `$splunk::params::manage_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -647,7 +647,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::forwarder_password_config_file` -##### `password_content` +##### `password_content` Data type: `String[1]` @@ -655,7 +655,7 @@ The hashed password username/details for the user. Default value: `$splunk::params::password_content` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -663,7 +663,7 @@ Which file we should put the secret in. Default value: `$splunk::params::forwarder_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -671,7 +671,7 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `service` +##### `service` Data type: `String[1]` @@ -680,7 +680,7 @@ are updated, not applicable when running in agent mode. Default value: `$splunk::params::enterprise_service` -##### `mode` +##### `mode` Data type: `Enum['agent', 'bolt']` @@ -692,7 +692,7 @@ Bolt Default value: `'bolt'` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -700,7 +700,7 @@ Data type: `String[1]` Default value: `$splunk::params::splunk_user` -### `splunk::enterprise::password::seed` +### `splunk::enterprise::password::seed` Implements the seeding and reseeding of the Splunk Enterprise admin password so it can be used outside of regular management of the whole stack to @@ -710,18 +710,18 @@ facilitate admin password resets through Bolt Plans The following parameters are available in the `splunk::enterprise::password::seed` class: -* [`reset_seeded_password`](#reset_seeded_password) -* [`password_config_file`](#password_config_file) -* [`seed_config_file`](#seed_config_file) -* [`seed_user`](#seed_user) -* [`password_hash`](#password_hash) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`service`](#service) -* [`mode`](#mode) -* [`splunk_user`](#splunk_user) +* [`reset_seeded_password`](#-splunk--enterprise--password--seed--reset_seeded_password) +* [`password_config_file`](#-splunk--enterprise--password--seed--password_config_file) +* [`seed_config_file`](#-splunk--enterprise--password--seed--seed_config_file) +* [`seed_user`](#-splunk--enterprise--password--seed--seed_user) +* [`password_hash`](#-splunk--enterprise--password--seed--password_hash) +* [`secret_file`](#-splunk--enterprise--password--seed--secret_file) +* [`secret`](#-splunk--enterprise--password--seed--secret) +* [`service`](#-splunk--enterprise--password--seed--service) +* [`mode`](#-splunk--enterprise--password--seed--mode) +* [`splunk_user`](#-splunk--enterprise--password--seed--splunk_user) -##### `reset_seeded_password` +##### `reset_seeded_password` Data type: `Boolean` @@ -730,7 +730,7 @@ import process on restart of the Splunk services. Default value: `$splunk::params::reset_seeded_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -739,7 +739,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::enterprise_password_config_file` -##### `seed_config_file` +##### `seed_config_file` Data type: `Stdlib::Absolutepath` @@ -748,7 +748,7 @@ restart. Default value: `$splunk::params::enterprise_seed_config_file` -##### `seed_user` +##### `seed_user` Data type: `String[1]` @@ -756,7 +756,7 @@ The local user (usually 'admin') imported by Splunk. Default value: `$splunk::params::seed_user` -##### `password_hash` +##### `password_hash` Data type: `String[1]` @@ -764,7 +764,7 @@ The hashed password for the admin user. Default value: `$splunk::params::password_hash` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -772,7 +772,7 @@ Which file we should put the secret in. Default value: `$splunk::params::enterprise_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -780,7 +780,7 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `service` +##### `service` Data type: `String[1]` @@ -789,7 +789,7 @@ are updated, not applicable when running in agent mode. Default value: `$splunk::params::enterprise_service` -##### `mode` +##### `mode` Data type: `Enum['agent', 'bolt']` @@ -801,7 +801,7 @@ Bolt Default value: `'bolt'` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -809,18 +809,18 @@ Data type: `String[1]` Default value: `$splunk::params::splunk_user` -### `splunk::enterprise::service` +### `splunk::enterprise::service` Private class declared by Class[splunk::enterprise] to define a service as its understood by Puppet using a dynamic set of data or platform specific sub-classes -### `splunk::enterprise::service::nix` +### `splunk::enterprise::service::nix` Private class declared by Class[splunk::enterprise::service] to provide platform specific service management on Linux or Unix type systems. -### `splunk::forwarder` +### `splunk::forwarder` Install and configure an instance of Splunk Universal Forwarder @@ -849,48 +849,48 @@ class { 'splunk::forwarder': The following parameters are available in the `splunk::forwarder` class: -* [`server`](#server) -* [`version`](#version) -* [`package_name`](#package_name) -* [`package_ensure`](#package_ensure) -* [`staging_dir`](#staging_dir) -* [`path_delimiter`](#path_delimiter) -* [`forwarder_package_src`](#forwarder_package_src) -* [`package_provider`](#package_provider) -* [`manage_package_source`](#manage_package_source) -* [`package_source`](#package_source) -* [`install_options`](#install_options) -* [`splunk_user`](#splunk_user) -* [`forwarder_homedir`](#forwarder_homedir) -* [`forwarder_confdir`](#forwarder_confdir) -* [`service_name`](#service_name) -* [`service_file`](#service_file) -* [`boot_start`](#boot_start) -* [`use_default_config`](#use_default_config) -* [`splunkd_listen`](#splunkd_listen) -* [`splunkd_port`](#splunkd_port) -* [`logging_port`](#logging_port) -* [`purge_inputs`](#purge_inputs) -* [`purge_outputs`](#purge_outputs) -* [`purge_props`](#purge_props) -* [`purge_transforms`](#purge_transforms) -* [`purge_web`](#purge_web) -* [`forwarder_input`](#forwarder_input) -* [`forwarder_output`](#forwarder_output) -* [`manage_password`](#manage_password) -* [`seed_password`](#seed_password) -* [`reset_seeded_password`](#reset_seeded_password) -* [`password_config_file`](#password_config_file) -* [`seed_config_file`](#seed_config_file) -* [`seed_user`](#seed_user) -* [`password_content`](#password_content) -* [`password_hash`](#password_hash) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`addons`](#addons) -* [`purge_deploymentclient`](#purge_deploymentclient) - -##### `server` +* [`server`](#-splunk--forwarder--server) +* [`version`](#-splunk--forwarder--version) +* [`package_name`](#-splunk--forwarder--package_name) +* [`package_ensure`](#-splunk--forwarder--package_ensure) +* [`staging_dir`](#-splunk--forwarder--staging_dir) +* [`path_delimiter`](#-splunk--forwarder--path_delimiter) +* [`forwarder_package_src`](#-splunk--forwarder--forwarder_package_src) +* [`package_provider`](#-splunk--forwarder--package_provider) +* [`manage_package_source`](#-splunk--forwarder--manage_package_source) +* [`package_source`](#-splunk--forwarder--package_source) +* [`install_options`](#-splunk--forwarder--install_options) +* [`splunk_user`](#-splunk--forwarder--splunk_user) +* [`forwarder_homedir`](#-splunk--forwarder--forwarder_homedir) +* [`forwarder_confdir`](#-splunk--forwarder--forwarder_confdir) +* [`service_name`](#-splunk--forwarder--service_name) +* [`service_file`](#-splunk--forwarder--service_file) +* [`boot_start`](#-splunk--forwarder--boot_start) +* [`use_default_config`](#-splunk--forwarder--use_default_config) +* [`splunkd_listen`](#-splunk--forwarder--splunkd_listen) +* [`splunkd_port`](#-splunk--forwarder--splunkd_port) +* [`logging_port`](#-splunk--forwarder--logging_port) +* [`purge_inputs`](#-splunk--forwarder--purge_inputs) +* [`purge_outputs`](#-splunk--forwarder--purge_outputs) +* [`purge_props`](#-splunk--forwarder--purge_props) +* [`purge_transforms`](#-splunk--forwarder--purge_transforms) +* [`purge_web`](#-splunk--forwarder--purge_web) +* [`forwarder_input`](#-splunk--forwarder--forwarder_input) +* [`forwarder_output`](#-splunk--forwarder--forwarder_output) +* [`manage_password`](#-splunk--forwarder--manage_password) +* [`seed_password`](#-splunk--forwarder--seed_password) +* [`reset_seeded_password`](#-splunk--forwarder--reset_seeded_password) +* [`password_config_file`](#-splunk--forwarder--password_config_file) +* [`seed_config_file`](#-splunk--forwarder--seed_config_file) +* [`seed_user`](#-splunk--forwarder--seed_user) +* [`password_content`](#-splunk--forwarder--password_content) +* [`password_hash`](#-splunk--forwarder--password_hash) +* [`secret_file`](#-splunk--forwarder--secret_file) +* [`secret`](#-splunk--forwarder--secret) +* [`addons`](#-splunk--forwarder--addons) +* [`purge_deploymentclient`](#-splunk--forwarder--purge_deploymentclient) + +##### `server` Data type: `String[1]` @@ -898,7 +898,7 @@ The fqdn or IP address of the Splunk server. Default value: `$splunk::params::server` -##### `version` +##### `version` Data type: `String[1]` @@ -907,7 +907,7 @@ manage. Default value: `$splunk::params::version` -##### `package_name` +##### `package_name` Data type: `String[1]` @@ -915,7 +915,7 @@ The name of the package(s) Puppet will use to install Splunk Forwarder. Default value: `$splunk::params::forwarder_package_name` -##### `package_ensure` +##### `package_ensure` Data type: `String[1]` @@ -923,7 +923,7 @@ Ensure parameter which will get passed to the Splunk package resource. Default value: `$splunk::params::forwarder_package_ensure` -##### `staging_dir` +##### `staging_dir` Data type: `String[1]` @@ -931,7 +931,7 @@ Root of the archive path to host the Splunk package. Default value: `$splunk::params::staging_dir` -##### `path_delimiter` +##### `path_delimiter` Data type: `String[1]` @@ -939,7 +939,7 @@ The path separator used in the archived path of the Splunk package. Default value: `$splunk::params::path_delimiter` -##### `forwarder_package_src` +##### `forwarder_package_src` Data type: `String[1]` @@ -951,7 +951,7 @@ a UNC path to the MSI. Default value: `$splunk::params::forwarder_package_src` -##### `package_provider` +##### `package_provider` Data type: `Optional[String[1]]` @@ -959,15 +959,15 @@ The package management system used to host the Splunk packages. Default value: `$splunk::params::package_provider` -##### `manage_package_source` +##### `manage_package_source` Data type: `Boolean` Whether or not to use the supplied `forwarder_package_src` param. -Default value: ``true`` +Default value: `true` -##### `package_source` +##### `package_source` Data type: `Optional[String[1]]` @@ -977,9 +977,9 @@ MSI, etc). If `enterprise_package_src` parameter is set in splunk::params and it is required. The URL can be of any protocol supported by the puppet/archive module. On Windows, this can be a UNC path to the MSI. -Default value: ``undef`` +Default value: `undef` -##### `install_options` +##### `install_options` Data type: `Splunk::Fwdinstalloptions` @@ -987,7 +987,7 @@ This variable is passed to the package resources' *install_options* parameter. Default value: `$splunk::params::forwarder_install_options` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -995,7 +995,7 @@ The user to run Splunk as. Default value: `$splunk::params::splunk_user` -##### `forwarder_homedir` +##### `forwarder_homedir` Data type: `Stdlib::Absolutepath` @@ -1003,7 +1003,7 @@ Specifies the Splunk Forwarder home directory. Default value: `$splunk::params::forwarder_homedir` -##### `forwarder_confdir` +##### `forwarder_confdir` Data type: `Stdlib::Absolutepath` @@ -1011,7 +1011,7 @@ Specifies the Splunk Forwarder configuration directory. Default value: `$splunk::params::forwarder_confdir` -##### `service_name` +##### `service_name` Data type: `String[1]` @@ -1019,7 +1019,7 @@ The name of the Splunk Forwarder service. Default value: `$splunk::params::forwarder_service` -##### `service_file` +##### `service_file` Data type: `Stdlib::Absolutepath` @@ -1027,7 +1027,7 @@ The path to the Splunk Forwarder service file. Default value: `$splunk::params::forwarder_service_file` -##### `boot_start` +##### `boot_start` Data type: `Boolean` @@ -1036,16 +1036,16 @@ manage the Splunk Forwarder service. Default value: `$splunk::params::boot_start` -##### `use_default_config` +##### `use_default_config` Data type: `Boolean` Whether or not the module should manage a default set of Splunk Forwarder configuration parameters. -Default value: ``true`` +Default value: `true` -##### `splunkd_listen` +##### `splunkd_listen` Data type: `Stdlib::IP::Address` @@ -1053,7 +1053,7 @@ The address on which splunkd should listen. Default value: `'127.0.0.1'` -##### `splunkd_port` +##### `splunkd_port` Data type: `Stdlib::Port` @@ -1061,7 +1061,7 @@ The management port for Splunk. Default value: `$splunk::params::splunkd_port` -##### `logging_port` +##### `logging_port` Data type: `Stdlib::Port` @@ -1069,52 +1069,52 @@ The port on which to send and listen for logs. Default value: `$splunk::params::logging_port` -##### `purge_inputs` +##### `purge_inputs` Data type: `Boolean` *Optional* If set to true, inputs.conf will be purged of configuration that is no longer managed by the `splunkforwarder_input` type. -Default value: ``false`` +Default value: `false` -##### `purge_outputs` +##### `purge_outputs` Data type: `Boolean` *Optional* If set to true, outputs.conf will be purged of configuration that is no longer managed by the `splunk_output` type. -Default value: ``false`` +Default value: `false` -##### `purge_props` +##### `purge_props` Data type: `Boolean` *Optional* If set to true, props.conf will be purged of configuration that is no longer managed by the `splunk_props` type. -Default value: ``false`` +Default value: `false` -##### `purge_transforms` +##### `purge_transforms` Data type: `Boolean` *Optional* If set to true, transforms.conf will be purged of configuration that is no longer managed by the `splunk_transforms` type. -Default value: ``false`` +Default value: `false` -##### `purge_web` +##### `purge_web` Data type: `Boolean` *Optional* If set to true, web.conf will be purged of configuration that is no longer managed by the `splunk_web` type. -Default value: ``false`` +Default value: `false` -##### `forwarder_input` +##### `forwarder_input` Data type: `Hash` @@ -1122,7 +1122,7 @@ Used to override the default `forwarder_input` type defined in splunk::params. Default value: `$splunk::params::forwarder_input` -##### `forwarder_output` +##### `forwarder_output` Data type: `Hash` @@ -1130,7 +1130,7 @@ Used to override the default `forwarder_output` type defined in splunk::params. Default value: `$splunk::params::forwarder_output` -##### `manage_password` +##### `manage_password` Data type: `Boolean` @@ -1138,7 +1138,7 @@ If set to true, Manage the contents of splunk.secret and passwd. Default value: `$splunk::params::manage_password` -##### `seed_password` +##### `seed_password` Data type: `Boolean` @@ -1146,7 +1146,7 @@ If set to true, Manage the contents of splunk.secret and user-seed.conf. Default value: `$splunk::params::seed_password` -##### `reset_seeded_password` +##### `reset_seeded_password` Data type: `Boolean` @@ -1155,7 +1155,7 @@ import process on restart of the Splunk services. Default value: `$splunk::params::reset_seeded_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -1164,7 +1164,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::forwarder_password_config_file` -##### `seed_config_file` +##### `seed_config_file` Data type: `Stdlib::Absolutepath` @@ -1173,7 +1173,7 @@ restart. Default value: `$splunk::params::forwarder_seed_config_file` -##### `seed_user` +##### `seed_user` Data type: `String[1]` @@ -1181,7 +1181,7 @@ The local user (usually 'admin') imported by Splunk. Default value: `$splunk::params::seed_user` -##### `password_content` +##### `password_content` Data type: `String[1]` @@ -1189,7 +1189,7 @@ The hashed password username/details for the user. Default value: `$splunk::params::password_content` -##### `password_hash` +##### `password_hash` Data type: `String[1]` @@ -1197,7 +1197,7 @@ The hashed password for the admin user. Default value: `$splunk::params::password_hash` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -1205,7 +1205,7 @@ Which file we should put the secret in. Default value: `$splunk::params::forwarder_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -1213,7 +1213,7 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `addons` +##### `addons` Data type: `Hash` @@ -1221,27 +1221,27 @@ Manage a splunk addons, see `splunk::addons`. Default value: `{}` -##### `purge_deploymentclient` +##### `purge_deploymentclient` Data type: `Boolean` -Default value: ``false`` +Default value: `false` -### `splunk::forwarder::config` +### `splunk::forwarder::config` Private class declared by Class[splunk::forwarder] to contain all the configuration needed for a base install of the Splunk Universal Forwarder -### `splunk::forwarder::install` +### `splunk::forwarder::install` Private class declared by Class[splunk::forwarder] to contain or define through additional platform specific sub-class, the required steps for successfully installing the Splunk Universal Forwarder -### `splunk::forwarder::password::manage` +### `splunk::forwarder::password::manage` Implements the direct management of the Splunk Forwarder admin password so it can be used outside of regular management of the whole stack to @@ -1254,16 +1254,16 @@ used to manage admin password seeding. The following parameters are available in the `splunk::forwarder::password::manage` class: -* [`manage_password`](#manage_password) -* [`password_config_file`](#password_config_file) -* [`password_content`](#password_content) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`service`](#service) -* [`mode`](#mode) -* [`splunk_user`](#splunk_user) +* [`manage_password`](#-splunk--forwarder--password--manage--manage_password) +* [`password_config_file`](#-splunk--forwarder--password--manage--password_config_file) +* [`password_content`](#-splunk--forwarder--password--manage--password_content) +* [`secret_file`](#-splunk--forwarder--password--manage--secret_file) +* [`secret`](#-splunk--forwarder--password--manage--secret) +* [`service`](#-splunk--forwarder--password--manage--service) +* [`mode`](#-splunk--forwarder--password--manage--mode) +* [`splunk_user`](#-splunk--forwarder--password--manage--splunk_user) -##### `manage_password` +##### `manage_password` Data type: `Boolean` @@ -1271,7 +1271,7 @@ If set to true, Manage the contents of splunk.secret and passwd. Default value: `$splunk::params::manage_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -1280,7 +1280,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::enterprise_password_config_file` -##### `password_content` +##### `password_content` Data type: `String[1]` @@ -1288,7 +1288,7 @@ The hashed password username/details for the user. Default value: `$splunk::params::password_content` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -1296,7 +1296,7 @@ Which file we should put the secret in. Default value: `$splunk::params::enterprise_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -1304,7 +1304,7 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `service` +##### `service` Data type: `String[1]` @@ -1313,7 +1313,7 @@ are updated, not applicable when running in agent mode. Default value: `$splunk::params::forwarder_service` -##### `mode` +##### `mode` Data type: `Enum['agent', 'bolt']` @@ -1325,7 +1325,7 @@ Bolt Default value: `'bolt'` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -1333,7 +1333,7 @@ Data type: `String[1]` Default value: `$splunk::params::splunk_user` -### `splunk::forwarder::password::seed` +### `splunk::forwarder::password::seed` Implements the seeding and reseeding of the Splunk Forwarder admin password so it can be used outside of regular management of the whole stack to @@ -1343,18 +1343,18 @@ facilitate admin password resets through Bolt Plans The following parameters are available in the `splunk::forwarder::password::seed` class: -* [`reset_seeded_password`](#reset_seeded_password) -* [`password_config_file`](#password_config_file) -* [`seed_config_file`](#seed_config_file) -* [`seed_user`](#seed_user) -* [`password_hash`](#password_hash) -* [`secret_file`](#secret_file) -* [`secret`](#secret) -* [`service`](#service) -* [`mode`](#mode) -* [`splunk_user`](#splunk_user) +* [`reset_seeded_password`](#-splunk--forwarder--password--seed--reset_seeded_password) +* [`password_config_file`](#-splunk--forwarder--password--seed--password_config_file) +* [`seed_config_file`](#-splunk--forwarder--password--seed--seed_config_file) +* [`seed_user`](#-splunk--forwarder--password--seed--seed_user) +* [`password_hash`](#-splunk--forwarder--password--seed--password_hash) +* [`secret_file`](#-splunk--forwarder--password--seed--secret_file) +* [`secret`](#-splunk--forwarder--password--seed--secret) +* [`service`](#-splunk--forwarder--password--seed--service) +* [`mode`](#-splunk--forwarder--password--seed--mode) +* [`splunk_user`](#-splunk--forwarder--password--seed--splunk_user) -##### `reset_seeded_password` +##### `reset_seeded_password` Data type: `Boolean` @@ -1363,7 +1363,7 @@ import process on restart of the Splunk services. Default value: `$splunk::params::reset_seeded_password` -##### `password_config_file` +##### `password_config_file` Data type: `Stdlib::Absolutepath` @@ -1372,7 +1372,7 @@ Which file to put the password in i.e. in linux it would be Default value: `$splunk::params::forwarder_password_config_file` -##### `seed_config_file` +##### `seed_config_file` Data type: `Stdlib::Absolutepath` @@ -1381,7 +1381,7 @@ restart. Default value: `$splunk::params::forwarder_seed_config_file` -##### `seed_user` +##### `seed_user` Data type: `String[1]` @@ -1389,7 +1389,7 @@ The local user (usually 'admin') imported by Splunk. Default value: `$splunk::params::seed_user` -##### `password_hash` +##### `password_hash` Data type: `String[1]` @@ -1397,7 +1397,7 @@ The hashed password for the admin user. Default value: `$splunk::params::password_hash` -##### `secret_file` +##### `secret_file` Data type: `Stdlib::Absolutepath` @@ -1405,7 +1405,7 @@ Which file we should put the secret in. Default value: `$splunk::params::forwarder_secret_file` -##### `secret` +##### `secret` Data type: `String[1]` @@ -1413,7 +1413,7 @@ The secret used to salt the splunk password. Default value: `$splunk::params::secret` -##### `service` +##### `service` Data type: `String[1]` @@ -1422,7 +1422,7 @@ are updated, not applicable when running in agent mode. Default value: `$splunk::params::forwarder_service` -##### `mode` +##### `mode` Data type: `Enum['agent', 'bolt']` @@ -1434,7 +1434,7 @@ Bolt Default value: `'bolt'` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` @@ -1442,18 +1442,18 @@ Data type: `String[1]` Default value: `$splunk::params::splunk_user` -### `splunk::forwarder::service` +### `splunk::forwarder::service` Private class declared by Class[splunk::forwarder] to define a service as its understood by Puppet using a dynamic set of data or platform specific sub-classes -### `splunk::forwarder::service::nix` +### `splunk::forwarder::service::nix` Private class declared by Class[splunk::forwarder::service] to provide platform specific service management on Linux or Unix type systems. -### `splunk::params` +### `splunk::params` This class takes a small number of arguments (can be set through Hiera) and generates sane default values installation media names and locations. @@ -1465,20 +1465,20 @@ parameters to be consumed by child classes. The following parameters are available in the `splunk::params` class: -* [`version`](#version) -* [`build`](#build) -* [`splunkd_port`](#splunkd_port) -* [`logging_port`](#logging_port) -* [`server`](#server) -* [`splunk_user`](#splunk_user) -* [`src_root`](#src_root) -* [`boot_start`](#boot_start) -* [`forwarder_installdir`](#forwarder_installdir) -* [`enterprise_installdir`](#enterprise_installdir) -* [`default_host`](#default_host) -* [`manage_net_tools`](#manage_net_tools) - -##### `version` +* [`version`](#-splunk--params--version) +* [`build`](#-splunk--params--build) +* [`splunkd_port`](#-splunk--params--splunkd_port) +* [`logging_port`](#-splunk--params--logging_port) +* [`server`](#-splunk--params--server) +* [`splunk_user`](#-splunk--params--splunk_user) +* [`src_root`](#-splunk--params--src_root) +* [`boot_start`](#-splunk--params--boot_start) +* [`forwarder_installdir`](#-splunk--params--forwarder_installdir) +* [`enterprise_installdir`](#-splunk--params--enterprise_installdir) +* [`default_host`](#-splunk--params--default_host) +* [`manage_net_tools`](#-splunk--params--manage_net_tools) + +##### `version` Data type: `String[1]` @@ -1487,7 +1487,7 @@ The version of Splunk to install. This will be in the form x.y.z; e.g. Default value: `'7.2.4.2'` -##### `build` +##### `build` Data type: `String[1]` @@ -1499,7 +1499,7 @@ e.g. "123586". Default value: `'fb30470262e3'` -##### `splunkd_port` +##### `splunkd_port` Data type: `Stdlib::Port` @@ -1507,7 +1507,7 @@ The splunkd port. Default value: `8089` -##### `logging_port` +##### `logging_port` Data type: `Stdlib::Port` @@ -1515,7 +1515,7 @@ The port on which to send logs, and listen for logs. Default value: `9997` -##### `server` +##### `server` Data type: `String[1]` @@ -1524,15 +1524,21 @@ the default TCP output and input. Default value: `'splunk'` -##### `splunk_user` +##### `splunk_user` Data type: `String[1]` The user that splunk runs as. -Default value: `$facts['os']['family']` +Default value: -##### `src_root` +```puppet +$facts['os']['family'] ? { + 'windows' => 'Administrator', + default => 'root' +``` + +##### `src_root` Data type: `String[1]` @@ -1585,7 +1591,7 @@ $root_url/ Default value: `'https://download.splunk.com'` -##### `boot_start` +##### `boot_start` Data type: `Boolean` @@ -1594,25 +1600,25 @@ Enable Splunk to start at boot, create a system service file. WARNING: Toggling `boot_start` from `false` to `true` will cause a restart of Splunk Enterprise and Forwarder services. -Default value: ``true`` +Default value: `true` -##### `forwarder_installdir` +##### `forwarder_installdir` Data type: `Optional[String[1]]` Optional directory in which to install and manage Splunk Forwarder -Default value: ``undef`` +Default value: `undef` -##### `enterprise_installdir` +##### `enterprise_installdir` Data type: `Optional[String[1]]` Optional directory in which to install and manage Splunk Enterprise -Default value: ``undef`` +Default value: `undef` -##### `default_host` +##### `default_host` Data type: `String[1]` @@ -1620,7 +1626,7 @@ The host property in inputs.conf. Defaults to the server's hostname. Default value: `$facts['clientcert']` -##### `manage_net_tools` +##### `manage_net_tools` Data type: `Boolean` @@ -1628,11 +1634,11 @@ From Splunk 7.2.2+ the package `net-tools` is required to be installed on the sy By default this module manages the resource Package[net-tools], if this resource is already declared on your code base, you can disable this flag. -Default value: ``true`` +Default value: `true` ## Defined types -### `splunk::addon` +### `splunk::addon` Defined type for deploying Splunk Add-ons and Apps from either OS packages or via splunkbase compatible archives @@ -1667,55 +1673,55 @@ splunk::addon { 'Splunk_TA_nix': The following parameters are available in the `splunk::addon` defined type: -* [`splunk_home`](#splunk_home) -* [`package_manage`](#package_manage) -* [`splunkbase_source`](#splunkbase_source) -* [`extract_command`](#extract_command) -* [`package_name`](#package_name) -* [`owner`](#owner) -* [`inputs`](#inputs) +* [`splunk_home`](#-splunk--addon--splunk_home) +* [`package_manage`](#-splunk--addon--package_manage) +* [`splunkbase_source`](#-splunk--addon--splunkbase_source) +* [`extract_command`](#-splunk--addon--extract_command) +* [`package_name`](#-splunk--addon--package_name) +* [`owner`](#-splunk--addon--owner) +* [`inputs`](#-splunk--addon--inputs) -##### `splunk_home` +##### `splunk_home` Data type: `Optional[Stdlib::Absolutepath]` Overrides the default Splunk installation target values from Class[splunk::params] -Default value: ``undef`` +Default value: `undef` -##### `package_manage` +##### `package_manage` Data type: `Boolean` If a package should be installed as part of declaring a new instance of Splunk::Addon -Default value: ``true`` +Default value: `true` -##### `splunkbase_source` +##### `splunkbase_source` Data type: `Optional[String[1]]` When set the add-on will be installed from a splunkbase compatible archive instead of OS packages -Default value: ``undef`` +Default value: `undef` -##### `extract_command` +##### `extract_command` Data type: `Optional[String[1]]` A 'extract_command' to pass to the 'archive' that extracts a splunkbase_source package (helpful for SPL files) -Default value: ``undef`` +Default value: `undef` -##### `package_name` +##### `package_name` Data type: `Optional[String[1]]` The OS package to install if you are not installing via splunk compatible archive -Default value: ``undef`` +Default value: `undef` -##### `owner` +##### `owner` Data type: `String[1]` @@ -1723,7 +1729,7 @@ The user that files are owned by when they are created as part of add-on install Default value: `'splunk'` -##### `inputs` +##### `inputs` Data type: `Hash` @@ -1741,9 +1747,9 @@ Manage splunk alert_actions settings in alert_actions.conf The following parameters are available in the `splunk_alert_actions` type. -* [`provider`](#provider) +* [`provider`](#-splunk_alert_actions--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_alert_actions` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1756,9 +1762,9 @@ Manage splunk authentication settings in authentication.conf The following parameters are available in the `splunk_authentication` type. -* [`provider`](#provider) +* [`provider`](#-splunk_authentication--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_authentication` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1771,9 +1777,9 @@ Manage splunk authorize settings in authorize.conf The following parameters are available in the `splunk_authorize` type. -* [`provider`](#provider) +* [`provider`](#-splunk_authorize--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_authorize` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1786,28 +1792,28 @@ splunk config The following parameters are available in the `splunk_config` type. -* [`forwarder_confdir`](#forwarder_confdir) -* [`forwarder_installdir`](#forwarder_installdir) -* [`name`](#name) -* [`server_confdir`](#server_confdir) -* [`server_installdir`](#server_installdir) +* [`forwarder_confdir`](#-splunk_config--forwarder_confdir) +* [`forwarder_installdir`](#-splunk_config--forwarder_installdir) +* [`name`](#-splunk_config--name) +* [`server_confdir`](#-splunk_config--server_confdir) +* [`server_installdir`](#-splunk_config--server_installdir) -##### `forwarder_confdir` +##### `forwarder_confdir` -##### `forwarder_installdir` +##### `forwarder_installdir` -##### `name` +##### `name` namevar splunk config -##### `server_confdir` +##### `server_confdir` -##### `server_installdir` +##### `server_installdir` ### `splunk_deploymentclient` @@ -1818,9 +1824,9 @@ Manage splunk deploymentclient entries in deploymentclient.conf The following parameters are available in the `splunk_deploymentclient` type. -* [`provider`](#provider) +* [`provider`](#-splunk_deploymentclient--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_deploymentclient` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1833,9 +1839,9 @@ Manage distsearch entries in distsearch.conf The following parameters are available in the `splunk_distsearch` type. -* [`provider`](#provider) +* [`provider`](#-splunk_distsearch--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_distsearch` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1848,9 +1854,9 @@ Manage splunk index settings in indexes.conf The following parameters are available in the `splunk_indexes` type. -* [`provider`](#provider) +* [`provider`](#-splunk_indexes--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_indexes` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1863,9 +1869,9 @@ Manage splunk input settings in inputs.conf The following parameters are available in the `splunk_input` type. -* [`provider`](#provider) +* [`provider`](#-splunk_input--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_input` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1878,9 +1884,9 @@ Manage splunk limits settings in limits.conf The following parameters are available in the `splunk_limits` type. -* [`provider`](#provider) +* [`provider`](#-splunk_limits--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_limits` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1893,9 +1899,9 @@ Manage metadata entries in {default,local}.meta The following parameters are available in the `splunk_metadata` type. -* [`provider`](#provider) +* [`provider`](#-splunk_metadata--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_metadata` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1908,9 +1914,9 @@ Manage splunk output settings in outputs.conf The following parameters are available in the `splunk_output` type. -* [`provider`](#provider) +* [`provider`](#-splunk_output--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_output` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1923,9 +1929,9 @@ Manage splunk prop settings in props.conf The following parameters are available in the `splunk_props` type. -* [`provider`](#provider) +* [`provider`](#-splunk_props--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_props` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1938,9 +1944,9 @@ Manage splunk server settings in server.conf The following parameters are available in the `splunk_server` type. -* [`provider`](#provider) +* [`provider`](#-splunk_server--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_server` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1953,9 +1959,9 @@ Manage splunk serverclass entries in serverclass.conf The following parameters are available in the `splunk_serverclass` type. -* [`provider`](#provider) +* [`provider`](#-splunk_serverclass--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_serverclass` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1968,9 +1974,9 @@ Manage splunk transforms settings in transforms.conf The following parameters are available in the `splunk_transforms` type. -* [`provider`](#provider) +* [`provider`](#-splunk_transforms--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_transforms` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1983,9 +1989,9 @@ Manage splunk web ui settings in ui-prefs.conf The following parameters are available in the `splunk_uiprefs` type. -* [`provider`](#provider) +* [`provider`](#-splunk_uiprefs--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_uiprefs` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1998,9 +2004,9 @@ Manage splunk web settings in web.conf The following parameters are available in the `splunk_web` type. -* [`provider`](#provider) +* [`provider`](#-splunk_web--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunk_web` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2013,9 +2019,9 @@ Manage splunkforwarder deploymentclient entries in deploymentclient.conf The following parameters are available in the `splunkforwarder_deploymentclient` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_deploymentclient--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_deploymentclient` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2028,9 +2034,9 @@ Manage splunkforwarder input settings in inputs.conf The following parameters are available in the `splunkforwarder_input` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_input--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_input` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2043,9 +2049,9 @@ Manage splunkforwarder limit settings in limits.conf The following parameters are available in the `splunkforwarder_limits` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_limits--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_limits` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2058,9 +2064,9 @@ Manage splunkforwarder output settings in outputs.conf The following parameters are available in the `splunkforwarder_output` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_output--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_output` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2073,9 +2079,9 @@ Manage splunkforwarder props settings in props.conf The following parameters are available in the `splunkforwarder_props` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_props--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_props` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2088,9 +2094,9 @@ Manage splunkforwarder server settings in server.conf The following parameters are available in the `splunkforwarder_server` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_server--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_server` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2103,9 +2109,9 @@ Manage splunkforwarder transforms settings in transforms.conf The following parameters are available in the `splunkforwarder_transforms` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_transforms--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_transforms` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -2118,32 +2124,24 @@ Manage splunkforwarder web settings in web.conf The following parameters are available in the `splunkforwarder_web` type. -* [`provider`](#provider) +* [`provider`](#-splunkforwarder_web--provider) -##### `provider` +##### `provider` The specific backend to use for this `splunkforwarder_web` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. ## Data types -### `Splunk::Entinstalloptions` +### `Splunk::Entinstalloptions` The Splunk::Entinstalloptions data type. -Alias of +Alias of `Variant[Tuple[Hash,Hash,String,3,default], Array[String[1]]]` -```puppet -Variant[Tuple[Hash,Hash,String,3,default], Array[String[1]]] -``` - -### `Splunk::Fwdinstalloptions` +### `Splunk::Fwdinstalloptions` The Splunk::Fwdinstalloptions data type. -Alias of - -```puppet -Variant[Tuple[Hash,String,1,default], Array[String[1]]] -``` +Alias of `Variant[Tuple[Hash,String,1,default], Array[String[1]]]` From b65e53b23eff12a8d6d24acb8306cea3ebbd1797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 27 Jun 2023 12:50:36 -1000 Subject: [PATCH 13/21] Autocorrect Rubocop offenses --- spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 55d5a336..47d2b04f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,6 +18,6 @@ end end -require 'splunk_data.rb' +require 'splunk_data' -$LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/fixtures/modules/inifile/lib" From 751b3c146d98332b254b4e09b3bb9e330a806e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 27 Jun 2023 13:15:10 -1000 Subject: [PATCH 14/21] Avoid modifying possibly frozen string literal --- lib/puppet_x/voxpupuli/splunk/util.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet_x/voxpupuli/splunk/util.rb b/lib/puppet_x/voxpupuli/splunk/util.rb index 1d828877..1c81c567 100644 --- a/lib/puppet_x/voxpupuli/splunk/util.rb +++ b/lib/puppet_x/voxpupuli/splunk/util.rb @@ -11,8 +11,7 @@ def self.decrypt(secrets_file, value) return value unless value.start_with?('$7$') Puppet.debug "Decrypting splunk >= 7.2 data using secret from #{secrets_file}" - value.slice!(0, 3) - data = Base64.strict_decode64(value) + data = Base64.strict_decode64(value[3..-1]) splunk_secret = File.binread(secrets_file).chomp iv = data.bytes[0, 16].pack('c*') From 7857e969bbcb2ba25f2133b01211098d7bb7a6bf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 17:28:13 +0200 Subject: [PATCH 15/21] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb..6aaa603f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160c..dd3e9572 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 98a04cfb..db21d3b5 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 47d2b04f..3f835632 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,6 +18,7 @@ end end -require 'splunk_data' +require 'splunk_data.rb' -$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/fixtures/modules/inifile/lib" +$LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From 255a2aff9e3298c336b6d277bdcc0a59404ff38c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 08:43:10 +0200 Subject: [PATCH 16/21] rubocop: autofix --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 20 ++++++++++++++++++++ spec/spec_helper.rb | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac1898..ea22bff8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..87167fb6 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,20 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-08-17 21:38:35 UTC using RuboCop version 1.50.2. +# 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: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/puppet_x/voxpupuli/splunk/util.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'spec/spec_helper.rb' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f835632..9ddfdde9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ end end -require 'splunk_data.rb' +require 'splunk_data' $LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From 6db433104c0bb26f167b682b3ba8fce99d2a35c7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 13:33:30 +0100 Subject: [PATCH 17/21] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + .rubocop.yml | 3 +-- Gemfile | 8 +++----- spec/spec_helper.rb | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a077911..b66d8ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f17213..55324aa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e9572..f8183449 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.2.0' diff --git a/.pmtignore b/.pmtignore index 58a04088..10b98306 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/.rubocop.yml b/.rubocop.yml index ea22bff8..fded90cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,7 @@ --- -inherit_from: .rubocop_todo.yml - # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-test: rubocop.yml diff --git a/Gemfile b/Gemfile index db21d3b5..a4a3b204 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9ddfdde9..3f835632 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ end end -require 'splunk_data' +require 'splunk_data.rb' $LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From 41ae9903393b16cd6f71b14a48e5ab3eff6a1962 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:41:08 +0100 Subject: [PATCH 18/21] modulesync 7.3.0 --- .github/workflows/ci.yml | 7 ++++++- .msync.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66d8ca7..7216724f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} diff --git a/.msync.yml b/.msync.yml index f8183449..f46ee025 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.2.0' +modulesync_config_version: '7.3.0' From 201601ea556ef0ce00b8b71c5268019ee1b0e835 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 11 Feb 2024 22:37:31 +0100 Subject: [PATCH 19/21] fix rubocop redundant .rb extension error --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f835632..9ddfdde9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ end end -require 'splunk_data.rb' +require 'splunk_data' $LOAD_PATH.unshift File.dirname(__FILE__) + '/fixtures/modules/inifile/lib' Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From a9438434aedf75708d4da9514755a0f8f900a4f8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 7 Mar 2024 08:21:09 +0100 Subject: [PATCH 20/21] drop ubuntu 18.04 support --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 0756ab0f..37085527 100644 --- a/metadata.json +++ b/metadata.json @@ -29,7 +29,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04", "20.04" ] }, From 77661fa2f99cf2a69f02f816cb1a3e651335ec6d Mon Sep 17 00:00:00 2001 From: Yves Siegrist Date: Sat, 16 Mar 2024 00:22:07 +0100 Subject: [PATCH 21/21] Fix tests Apparently running on GitHub actions doesn't support a filesystem that will correctly handle file locks? Let's use the Splunk provided option to be able for Splunkd to start. --- spec/acceptance/splunk_enterprise_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/acceptance/splunk_enterprise_spec.rb b/spec/acceptance/splunk_enterprise_spec.rb index 66372b8d..c59baa01 100644 --- a/spec/acceptance/splunk_enterprise_spec.rb +++ b/spec/acceptance/splunk_enterprise_spec.rb @@ -15,6 +15,13 @@ it 'works idempotently with no errors' do pp = <<-EOS class { 'splunk::enterprise': } + + # See https://community.splunk.com/t5/Installation/Why-am-I-getting-an-error-to-start-a-fresh-Splunk-instance-in-my/m-p/336938 + file_line { 'file_locking': + path => '/opt/splunk/etc/splunk-launch.conf', + line => 'OPTIMISTIC_ABOUT_FILE_LOCKING=1', + require => Class['splunk::enterprise'], + } EOS # Run it twice and test for idempotency