Skip to content

Commit

Permalink
collectd doesn't auto-include its java dir in class path :(
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchen committed Jan 20, 2015
1 parent f68c147 commit e785050
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$service_name = 'collectd'
$config_file = "${collectd_dir}/collectd.conf"
$root_group = 'root'
$java_dir = '/usr/share/collectd/java'
}
'Solaris': {
$package = 'CSWcollectd'
Expand All @@ -19,6 +20,7 @@
$service_name = 'collectd'
$config_file = "${collectd_dir}/collectd.conf"
$root_group = 'root'
# FIXME: $java_dir
}
'Redhat': {
$package = 'collectd'
Expand All @@ -28,6 +30,7 @@
$service_name = 'collectd'
$config_file = '/etc/collectd.conf'
$root_group = 'root'
$java_dir = '/usr/share/collectd/java'
}
'Suse': {
$package = 'collectd'
Expand All @@ -37,6 +40,7 @@
$service_name = 'collectd'
$config_file = '/etc/collectd.conf'
$root_group = 'root'
# FIXME: $java_dir
}
'FreeBSD': {
$package = 'collectd5'
Expand All @@ -46,6 +50,7 @@
$service_name = 'collectd'
$config_file = '/usr/local/etc/collectd.conf'
$root_group = 'wheel'
# FIXME: $java_dir
}
'Archlinux': {
$package = 'collectd'
Expand All @@ -55,6 +60,7 @@
$service_name = 'collectd'
$config_file = '/etc/collectd.conf'
$root_group = 'wheel'
# FIXME: $java_dir
}
'Gentoo': {
$package = 'app-admin/collectd'
Expand All @@ -64,6 +70,7 @@
$service_name = 'collectd'
$config_file = '/etc/collectd.conf'
$root_group = 'collectd'
# FIXME: $java_dir
}

default: {
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/genericjmx.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include collectd
include collectd::params
include collectd::plugin::java

$class_path = "${collectd::params::java_dir}/collectd-api.jar:${collectd::params::java_dir}/generic-jmx.jar"
$config_file = "${collectd::params::plugin_conf_dir}/15-genericjmx.conf"

concat { $config_file:
Expand Down
12 changes: 6 additions & 6 deletions spec/classes/collectd_plugin_genericjmx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

describe 'collectd::plugin::genericjmx', :type => :class do
let (:facts) {{
:osfamily => 'RedHat',
:osfamily => 'Debian',
:concat_basedir => tmpfilename('collectd-genericjmx'),
}}

let (:config_filename) { '/etc/collectd.d/15-genericjmx.conf' }
let (:config_filename) { '/etc/collectd/conf.d/15-genericjmx.conf' }

context ':ensure => present, defaults' do
it 'will include the java plugin' do
Expand Down Expand Up @@ -64,15 +64,15 @@
it 'should have one jvmarg parameter' do
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').with_content(/JVMArg "bat"/)
end
it 'should have ONLY one jvmarg parameter' do
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){2,}/m)
it 'should have ONLY one jvmarg parameter other than classpath' do
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){3,}/m)
end
end

context 'jvmarg parameter empty' do
let (:params) {{ :jvmarg => [] }}
it 'should not have any jvmarg parameters' do
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/JVMArg/)
it 'should wnot have any jvmarg parameters other than classpath' do
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){2,}/m)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions templates/plugin/genericjmx.conf.header.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Plugin "java">
JVMArg "-Djava.class.path=<%= @class_path %>"
<% Array(@jvmarg).each do |jvmarg| -%>
JVMArg "<%= jvmarg %>"
<% end -%>
Expand Down

0 comments on commit e785050

Please sign in to comment.