puppet-zabbix
                                
                                 puppet-zabbix copied to clipboard
                                
                                    puppet-zabbix copied to clipboard
                            
                            
                            
                        LogType parameter being set in conf for zabbix <3.0
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 3.8.2
- Ruby: 1.8.7
- Distribution: RHEL6.8
- Module version: master
How to reproduce (e.g Puppet code you use)
include ::zabbix::agent
Hiera for this node contains
zabbix::zabbix_version: '2.4'
What are you seeing
I've deleted the zabbix_agentd.conf so that puppet creates a new one.
Error: Could not start Service[zabbix-agent]: Execution of '/sbin/service zabbix-agent start' returned 1: Starting Zabbix Agent: zabbix_agentd [828]: unknown parameter [LogType] in config file [/etc/zabbix/zabbix_agentd.conf], line 19
[FAILED]
Error: /Stage[main]/Zabbix::Agent/Service[zabbix-agent]/ensure: change from stopped to running failed: Could not start Service[zabbix-agent]: Execution of '/sbin/service zabbix-agent start' returned 1: Starting Zabbix Agent: zabbix_agentd [828]: unknown parameter [LogType] in config file [/etc/zabbix/zabbix_agentd.conf], line 19
[FAILED]
What behaviour did you expect instead
The Agent would startup
Output log
Config file contains
### Option: LogType
#       Specifies where log messages are written to:
#               system  - syslog
#               file    - file specified with LogFile parameter
#               console - standard output
#
LogType=file
Any additional information you'd like to impart
The test cases for the agent does not specifically test for agents <3.0. There needs to be a test case for to pick up this issue.
Offending code is in the template zabbix_agentd.conf.erb lines 13-33.
<% if @zabbix_version.to_f >= 3.0 -%>
### Option: LogType
#   Specifies where log messages are written to:
#       system  - syslog
#       file    - file specified with LogFile parameter
#       console - standard output
#
<% if @logtype %>LogType=<%= @logtype %><% end %>
### Option: LogFile
#   Log file name for LogType 'file' parameter.
#
LogFile=<%= @logfile %>
<% else %>
### Option: LogFile
#   Name of log file.
#   If not set, syslog is used.
#
LogFile=<%= @logfile %>
<% end %>
I dont think if @zabbix_version.to_f >= 3.0 is being evaluated correctly?
Update:
I've tested on another setup running Puppet 4.5.0, and the module works as expected by adding LogType for zabbox >=3.0 and removing it for zabbix <3.0.