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

Fix ignoreselected typo in protocols.conf.erb template #957

Merged
merged 2 commits into from
Sep 25, 2020
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
6 changes: 3 additions & 3 deletions manifests/plugin/protocols.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_protocols
class collectd::plugin::protocols (
$ensure = 'present',
Boolean $ignoreselected = false,
Array $values = []
$ensure = 'present',
Optional[Boolean] $ignoreselected = undef,
Array $values = []
) {
include collectd

Expand Down
24 changes: 24 additions & 0 deletions spec/classes/collectd_plugin_protocols_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@
end
end

describe 'ignoreselected' do
context ':ignoreselected => false' do
let :params do
{
values: %w[protocol1 protocol2],
ignoreselected: false
}
end

it { is_expected.to contain_file('protocols.load').with_content(%r{<Plugin "protocols">\n\s*Value "protocol1"\n\s*Value "protocol2"\n\s*IgnoreSelected false\n</Plugin>}) }
end

context ':ignoreselected => true' do
let :params do
{
values: %w[protocol1 protocol2],
ignoreselected: true
}
end

it { is_expected.to contain_file('protocols.load').with_content(%r{<Plugin "protocols">\n\s*Value "protocol1"\n\s*Value "protocol2"\n\s*IgnoreSelected true\n</Plugin>}) }
end
end

context ':ensure => absent' do
let :params do
{ ensure: 'absent' }
Expand Down
8 changes: 4 additions & 4 deletions templates/plugin/protocols.conf.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<% if @values -%>
<Plugin "protocols">
<%
<%
if @values
@values.each do |value|
@values.each do |value|
-%>
Value "<%= value %>"
<%
end
end
-%>
<% if @ignore_selected != nil -%>
IgnoreSelected <%= @ignore_selected %>
<% unless @ignoreselected == nil -%>
IgnoreSelected <%= @ignoreselected %>
<% end -%>
</Plugin>
<% end -%>