Skip to content

Commit e785050

Browse files
committed
collectd doesn't auto-include its java dir in class path :(
1 parent f68c147 commit e785050

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

manifests/params.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$service_name = 'collectd'
1111
$config_file = "${collectd_dir}/collectd.conf"
1212
$root_group = 'root'
13+
$java_dir = '/usr/share/collectd/java'
1314
}
1415
'Solaris': {
1516
$package = 'CSWcollectd'
@@ -19,6 +20,7 @@
1920
$service_name = 'collectd'
2021
$config_file = "${collectd_dir}/collectd.conf"
2122
$root_group = 'root'
23+
# FIXME: $java_dir
2224
}
2325
'Redhat': {
2426
$package = 'collectd'
@@ -28,6 +30,7 @@
2830
$service_name = 'collectd'
2931
$config_file = '/etc/collectd.conf'
3032
$root_group = 'root'
33+
$java_dir = '/usr/share/collectd/java'
3134
}
3235
'Suse': {
3336
$package = 'collectd'
@@ -37,6 +40,7 @@
3740
$service_name = 'collectd'
3841
$config_file = '/etc/collectd.conf'
3942
$root_group = 'root'
43+
# FIXME: $java_dir
4044
}
4145
'FreeBSD': {
4246
$package = 'collectd5'
@@ -46,6 +50,7 @@
4650
$service_name = 'collectd'
4751
$config_file = '/usr/local/etc/collectd.conf'
4852
$root_group = 'wheel'
53+
# FIXME: $java_dir
4954
}
5055
'Archlinux': {
5156
$package = 'collectd'
@@ -55,6 +60,7 @@
5560
$service_name = 'collectd'
5661
$config_file = '/etc/collectd.conf'
5762
$root_group = 'wheel'
63+
# FIXME: $java_dir
5864
}
5965
'Gentoo': {
6066
$package = 'app-admin/collectd'
@@ -64,6 +70,7 @@
6470
$service_name = 'collectd'
6571
$config_file = '/etc/collectd.conf'
6672
$root_group = 'collectd'
73+
# FIXME: $java_dir
6774
}
6875

6976
default: {

manifests/plugin/genericjmx.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
include collectd
77
include collectd::params
88
include collectd::plugin::java
9-
9+
$class_path = "${collectd::params::java_dir}/collectd-api.jar:${collectd::params::java_dir}/generic-jmx.jar"
1010
$config_file = "${collectd::params::plugin_conf_dir}/15-genericjmx.conf"
1111

1212
concat { $config_file:

spec/classes/collectd_plugin_genericjmx_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
describe 'collectd::plugin::genericjmx', :type => :class do
44
let (:facts) {{
5-
:osfamily => 'RedHat',
5+
:osfamily => 'Debian',
66
:concat_basedir => tmpfilename('collectd-genericjmx'),
77
}}
88

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

1111
context ':ensure => present, defaults' do
1212
it 'will include the java plugin' do
@@ -64,15 +64,15 @@
6464
it 'should have one jvmarg parameter' do
6565
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').with_content(/JVMArg "bat"/)
6666
end
67-
it 'should have ONLY one jvmarg parameter' do
68-
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){2,}/m)
67+
it 'should have ONLY one jvmarg parameter other than classpath' do
68+
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){3,}/m)
6969
end
7070
end
7171

7272
context 'jvmarg parameter empty' do
7373
let (:params) {{ :jvmarg => [] }}
74-
it 'should not have any jvmarg parameters' do
75-
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/JVMArg/)
74+
it 'should wnot have any jvmarg parameters other than classpath' do
75+
should contain_concat__fragment('collectd_plugin_genericjmx_conf_header').without_content(/(.*JVMArg.*){2,}/m)
7676
end
7777
end
7878
end

templates/plugin/genericjmx.conf.header.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Plugin "java">
2+
JVMArg "-Djava.class.path=<%= @class_path %>"
23
<% Array(@jvmarg).each do |jvmarg| -%>
34
JVMArg "<%= jvmarg %>"
45
<% end -%>

0 commit comments

Comments
 (0)