Skip to content

Commit

Permalink
Change default value of socketdir to undef from explicit default.
Browse files Browse the repository at this point in the history
I realized, after the fact, that the better code pattern rather than explicitly configuring the default value to the implied default is to omit it from the configuration file by the default by using a default of undef and conditional statements.
  • Loading branch information
wdberry committed Oct 26, 2020
1 parent b003d5a commit 9a31243
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 98 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
$include_dir = $zabbix::params::server_include,
$loadmodulepath = $zabbix::params::server_loadmodulepath,
$loadmodule = $zabbix::params::server_loadmodule,
Stdlib::Absolutepath $socketdir = $zabbix::params::server_socketdir,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
String $additional_service_params = $zabbix::params::additional_service_params,
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
$server_vmwarecachesize = '8M'
$server_vmwarefrequency = '60'
$server_vmwaretimeout = undef
$server_socketdir = '/tmp'
$server_socketdir = undef

# Agent specific params
$agent_allowroot = '0'
Expand Down Expand Up @@ -427,7 +427,7 @@
$proxy_zabbix_server_port = '10051'
$proxy_zbx_templates = ['Template App Zabbix Proxy']
$proxy_socketdir = versioncmp($zabbix_version, '5.0') ? {
-1 => '/tmp',
-1 => undef,
default => '/var/run/zabbix',
}

Expand Down
184 changes: 92 additions & 92 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -336,98 +336,98 @@
# Copyright 2014 Werner Dijkerman
#
class zabbix::proxy (
Zabbix::Databases $database_type = $zabbix::params::database_type,
$database_path = $zabbix::params::database_path,
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Boolean $manage_database = $zabbix::params::manage_database,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_resources = $zabbix::params::manage_resources,
Boolean $manage_service = $zabbix::params::manage_service,
$zabbix_proxy = $zabbix::params::zabbix_proxy,
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
$use_ip = $zabbix::params::proxy_use_ip,
$zbx_templates = $zabbix::params::proxy_zbx_templates,
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
$proxy_service_name = $zabbix::params::proxy_service_name,
$mode = $zabbix::params::proxy_mode,
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
$hostname = $zabbix::params::proxy_hostname,
$listenport = $zabbix::params::proxy_listenport,
$sourceip = $zabbix::params::proxy_sourceip,
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
$logfile = $zabbix::params::proxy_logfile,
$logfilesize = $zabbix::params::proxy_logfilesize,
$debuglevel = $zabbix::params::proxy_debuglevel,
$pidfile = $zabbix::params::proxy_pidfile,
$database_schema_path = $zabbix::params::database_schema_path,
$database_host = $zabbix::params::proxy_database_host,
$database_name = $zabbix::params::proxy_database_name,
$database_schema = $zabbix::params::proxy_database_schema,
$database_user = $zabbix::params::proxy_database_user,
$database_password = $zabbix::params::proxy_database_password,
$database_socket = $zabbix::params::proxy_database_socket,
$database_port = $zabbix::params::proxy_database_port,
$localbuffer = $zabbix::params::proxy_localbuffer,
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
$configfrequency = $zabbix::params::proxy_configfrequency,
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
$startpollers = $zabbix::params::proxy_startpollers,
$startipmipollers = $zabbix::params::proxy_startipmipollers,
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
$starttrappers = $zabbix::params::proxy_starttrappers,
$startpingers = $zabbix::params::proxy_startpingers,
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
$starthttppollers = $zabbix::params::proxy_starthttppollers,
$javagateway = $zabbix::params::proxy_javagateway,
$javagatewayport = $zabbix::params::proxy_javagatewayport,
$startjavapollers = $zabbix::params::proxy_startjavapollers,
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
$snmptrapper = $zabbix::params::proxy_snmptrapper,
$listenip = $zabbix::params::proxy_listenip,
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
$cachesize = $zabbix::params::proxy_cachesize,
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
$historycachesize = $zabbix::params::proxy_historycachesize,
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
$timeout = $zabbix::params::proxy_timeout,
$tlsaccept = $zabbix::params::proxy_tlsaccept,
$tlscafile = $zabbix::params::proxy_tlscafile,
$tlscertfile = $zabbix::params::proxy_tlscertfile,
$tlsconnect = $zabbix::params::proxy_tlsconnect,
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
$tlspskfile = $zabbix::params::proxy_tlspskfile,
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
$trappertimeout = $zabbix::params::proxy_trappertimeout,
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
$externalscripts = $zabbix::params::proxy_externalscripts,
$fpinglocation = $zabbix::params::proxy_fpinglocation,
$fping6location = $zabbix::params::proxy_fping6location,
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
$logslowqueries = $zabbix::params::proxy_logslowqueries,
$tmpdir = $zabbix::params::proxy_tmpdir,
$allowroot = $zabbix::params::proxy_allowroot,
$include_dir = $zabbix::params::proxy_include,
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
$loadmodule = $zabbix::params::proxy_loadmodule,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
Stdlib::Absolutepath $socketdir = $zabbix::params::proxy_socketdir,
Zabbix::Databases $database_type = $zabbix::params::database_type,
$database_path = $zabbix::params::database_path,
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Boolean $manage_database = $zabbix::params::manage_database,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_resources = $zabbix::params::manage_resources,
Boolean $manage_service = $zabbix::params::manage_service,
$zabbix_proxy = $zabbix::params::zabbix_proxy,
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
$use_ip = $zabbix::params::proxy_use_ip,
$zbx_templates = $zabbix::params::proxy_zbx_templates,
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
$proxy_service_name = $zabbix::params::proxy_service_name,
$mode = $zabbix::params::proxy_mode,
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
$hostname = $zabbix::params::proxy_hostname,
$listenport = $zabbix::params::proxy_listenport,
$sourceip = $zabbix::params::proxy_sourceip,
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
$logfile = $zabbix::params::proxy_logfile,
$logfilesize = $zabbix::params::proxy_logfilesize,
$debuglevel = $zabbix::params::proxy_debuglevel,
$pidfile = $zabbix::params::proxy_pidfile,
$database_schema_path = $zabbix::params::database_schema_path,
$database_host = $zabbix::params::proxy_database_host,
$database_name = $zabbix::params::proxy_database_name,
$database_schema = $zabbix::params::proxy_database_schema,
$database_user = $zabbix::params::proxy_database_user,
$database_password = $zabbix::params::proxy_database_password,
$database_socket = $zabbix::params::proxy_database_socket,
$database_port = $zabbix::params::proxy_database_port,
$localbuffer = $zabbix::params::proxy_localbuffer,
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
$configfrequency = $zabbix::params::proxy_configfrequency,
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
$startpollers = $zabbix::params::proxy_startpollers,
$startipmipollers = $zabbix::params::proxy_startipmipollers,
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
$starttrappers = $zabbix::params::proxy_starttrappers,
$startpingers = $zabbix::params::proxy_startpingers,
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
$starthttppollers = $zabbix::params::proxy_starthttppollers,
$javagateway = $zabbix::params::proxy_javagateway,
$javagatewayport = $zabbix::params::proxy_javagatewayport,
$startjavapollers = $zabbix::params::proxy_startjavapollers,
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
$snmptrapper = $zabbix::params::proxy_snmptrapper,
$listenip = $zabbix::params::proxy_listenip,
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
$cachesize = $zabbix::params::proxy_cachesize,
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
$historycachesize = $zabbix::params::proxy_historycachesize,
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
$timeout = $zabbix::params::proxy_timeout,
$tlsaccept = $zabbix::params::proxy_tlsaccept,
$tlscafile = $zabbix::params::proxy_tlscafile,
$tlscertfile = $zabbix::params::proxy_tlscertfile,
$tlsconnect = $zabbix::params::proxy_tlsconnect,
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
$tlspskfile = $zabbix::params::proxy_tlspskfile,
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
$trappertimeout = $zabbix::params::proxy_trappertimeout,
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
$externalscripts = $zabbix::params::proxy_externalscripts,
$fpinglocation = $zabbix::params::proxy_fpinglocation,
$fping6location = $zabbix::params::proxy_fping6location,
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
$logslowqueries = $zabbix::params::proxy_logslowqueries,
$tmpdir = $zabbix::params::proxy_tmpdir,
$allowroot = $zabbix::params::proxy_allowroot,
$include_dir = $zabbix::params::proxy_include,
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
$loadmodule = $zabbix::params::proxy_loadmodule,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::proxy_socketdir,
) inherits zabbix::params {
# check osfamily, Arch is currently not supported for web
if $facts['os']['family'] == 'Archlinux' {
Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
String $additional_service_params = $zabbix::params::additional_service_params,
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
Stdlib::Absolutepath $socketdir = $zabbix::params::server_socketdir,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
) inherits zabbix::params {
# the following codeblock is a bit blargh. The correct default value for
# $real_additional_service_params changes based on the value of $zabbix_version
Expand Down
2 changes: 1 addition & 1 deletion templates/zabbix_proxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ PidFile=<%= @pidfile %>
# Mandatory: no
# Default:

SocketDir=<%= @socketdir %>
<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
<% end %>

### Option: DBHost
Expand Down
2 changes: 1 addition & 1 deletion templates/zabbix_server.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PidFile=<%= @pidfile %>
# Mandatory: no
# Default:

SocketDir=<%= @socketdir %>
<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
<% end %>

### Option: DBHost
Expand Down

0 comments on commit 9a31243

Please sign in to comment.