Skip to content

Commit

Permalink
collectd doesn't like having an empty <Plugin java> stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchen committed Jan 16, 2015
1 parent 8031829 commit 9276be2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion spec/classes/collectd_plugin_java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
:path => '/etc/collectd.d/10-java.conf',
})

should contain_file('java.load').with_content(/<Plugin java>/)
should contain_file('java.load').without_content(/JVMArg/)
end
end
Expand Down Expand Up @@ -53,5 +52,15 @@
should contain_file('java.load').without_content(/(.*JVMArg.*){2,}/)
end
end

context 'jvmarg parameter empty' do
let (:params) {{
:jvmarg => [],
}}

it 'will not have a <Plugin java> stanza' do
should contain_file('java.load').without_content(/<Plugin java>/)
end
end
end

6 changes: 3 additions & 3 deletions templates/plugin/java.conf.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if !Array(@jvmarg).empty? -%>
<Plugin java>
<% if @jvmarg -%>
<% Array(@jvmarg).each do |arg| -%>
<% Array(@jvmarg).each do |arg| -%>
JVMArg "<%= arg %>"
<% end -%>
<% end -%>
</Plugin>
<% end -%>

0 comments on commit 9276be2

Please sign in to comment.