Skip to content

Commit

Permalink
Merge pull request #201 from gregswift/let-splunk-handle-it
Browse files Browse the repository at this point in the history
Allow empty local and outputs files to keep centralized Splunk happier.
  • Loading branch information
bastelfreak authored Oct 19, 2018
2 parents 9463aa5 + 43c7e45 commit a763bfd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
14 changes: 12 additions & 2 deletions manifests/forwarder.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
# If set to true, will remove any outputs.conf configuration not supplied by
# Puppet from the target system. Defaults to false.
#
# [*forwarder_output*]
# Hash of output configs. If undefined will not populate the outputs.conf file.
#
# [*forwarder_input*]
# Hash of input configs. If undefined will not populate the inputs.conf file.
#
# Actions:
#
# Declares parameters to be consumed by other classes in the splunk module.
Expand Down Expand Up @@ -112,8 +118,12 @@

# Declare inputs and outputs specific to the forwarder profile
$tag_resources = { tag => 'splunk_forwarder' }
create_resources( 'splunkforwarder_input',$forwarder_input, $tag_resources)
create_resources( 'splunkforwarder_output',$forwarder_output, $tag_resources)
if $forwarder_input {
create_resources( 'splunkforwarder_input',$forwarder_input, $tag_resources)
}
if $forwarder_output {
create_resources( 'splunkforwarder_output',$forwarder_output, $tag_resources)
}
# this is default
splunkforwarder_web { 'forwarder_splunkd_port':
section => 'settings',
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/forwarder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
context 'with defaults' do
it { is_expected.to compile.with_all_deps }
end

context 'with forwarder_output set to undef' do
let(:params) { { 'forwarder_output' => :undef } }

it { is_expected.to compile.with_all_deps }
end

context 'with forwarder_input set to undef' do
let(:params) { { 'forwarder_input' => :undef } }

it { is_expected.to compile.with_all_deps }
end
end
end
end

0 comments on commit a763bfd

Please sign in to comment.