puppet-collectd icon indicating copy to clipboard operation
puppet-collectd copied to clipboard

collectd fails to start as generated config includes empty config

Open sammcj opened this issue 7 years ago • 1 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.1 / PE 2018.1
  • Ruby: 2.4.3p205
  • Distribution: CentOS 7.5
  • Module version: v9.0.1

How to reproduce (e.g Puppet code you use)

include ::collectd

What are you seeing

collectd service fails to start using puppet generated config

What behaviour did you expect instead

collectd should start with minimal config.

/etc/collectd.conf should not contain Include "/etc/collectd.d/*.conf" unless there are files present in that directory.

/etc/collectd.conf:

# Generated by Puppet

#Hostname localhost
FQDNLookup true

#BaseDir "/var/lib/collectd"
#PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
Interval 10
Timeout 2
ReadThreads 5
WriteThreads 5
Include "/etc/collectd.d/*.conf"

/etc/collectd.d is empty by default:

~  # ls /etc/collectd.d/*.conf
ls: cannot access /etc/collectd.d/*.conf: No such file or directory

collectd cannot start:

~ # collectd
configfile: stat (/etc/collectd.d/*.conf) failed: No such file or directory

creating a blank conf file in /etc/collectd.d allows collectd to start:

~ # touch /etc/collectd.d/dummy.conf
~ # collectd

sammcj avatar May 31 '18 03:05 sammcj

Trudging through the code recently myself while trying to refactor large parts of it, I'm not sure why the default is not purge => true rather than the current method of adding lines to a config that may or may not be put on disk by the collectd package. Perhaps adding a simple $manage_config => false parameter would be more flexible and more transparent to the user....

juniorsysadmin avatar May 31 '18 11:05 juniorsysadmin