Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow empty local and outputs files to keep centralized Splunk happier. #201

Merged
merged 7 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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