Skip to content

Commit

Permalink
Adds config file validation for fpm service
Browse files Browse the repository at this point in the history
Defines validation command for fpm service configuration files, and
sets it as a requirement.
  • Loading branch information
Federico Fapitalle committed Jun 19, 2020
1 parent eb304ad commit 2a6184c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
11 changes: 6 additions & 5 deletions manifests/fpm/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@
}

file { $config_file:
ensure => file,
content => template('php/fpm/php-fpm.conf.erb'),
owner => root,
group => $root_group,
mode => '0644',
ensure => file,
content => template('php/fpm/php-fpm.conf.erb'),
owner => root,
group => $root_group,
mode => '0644',
validate_cmd => $php::globals::fpm_checkconf_cmd,
}

ensure_resource('file', ['/var/run/php-fpm/', '/var/log/php-fpm/'], {
Expand Down
15 changes: 8 additions & 7 deletions manifests/fpm/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,14 @@
}
} else {
file { "${pool_base_dir}/${pool}.conf":
ensure => file,
notify => Class['::php::fpm::service'],
require => Package[$real_package],
content => template($template),
owner => root,
group => $root_group,
mode => '0640',
ensure => file,
notify => Class['::php::fpm::service'],
require => Package[$real_package],
content => template($template),
owner => root,
group => $root_group,
mode => '0640',
validate_cmd => $php::globals::fpm_checkconf_cmd,
}
}
}
5 changes: 5 additions & 0 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = '/var/log/php5-fpm.log'
$fpm_service_name = 'php5-fpm'
$fpm_checkconf_cmd = '/usr/sbin/php5-fpm -t --fpm-config %'
$ext_tool_enable = '/usr/sbin/php5enmod'
$ext_tool_query = '/usr/sbin/php5query'
$package_prefix = 'php5-'
Expand All @@ -60,6 +61,7 @@
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = "/var/log/php${globals_php_version}-fpm.log"
$fpm_service_name = "php${globals_php_version}-fpm"
$fpm_checkconf_cmd = "/usr/sbin/php-fpm${globals_php_version} -t --fpm-config %"
$ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}"
$ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}"
$package_prefix = "php${globals_php_version}-"
Expand All @@ -71,6 +73,7 @@
$default_fpm_pid_file = '/var/run/php5-fpm.pid'
$fpm_error_log = '/var/log/php5-fpm.log'
$fpm_service_name = 'php5-fpm'
$fpm_checkconf_cmd = '/usr/sbin/php5-fpm -t --fpm-config %'
$ext_tool_enable = '/usr/sbin/php5enmod'
$ext_tool_query = '/usr/sbin/php5query'
$package_prefix = 'php5-'
Expand All @@ -84,6 +87,7 @@
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = "/var/log/php${globals_php_version}-fpm.log"
$fpm_service_name = "php${globals_php_version}-fpm"
$fpm_checkconf_cmd = "/usr/sbin/php-fpm${globals_php_version} -t --fpm-config %"
$ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}"
$ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}"
$package_prefix = "php${globals_php_version}-"
Expand All @@ -93,6 +97,7 @@
$default_fpm_pid_file = '/var/run/php5-fpm.pid'
$fpm_error_log = '/var/log/php5-fpm.log'
$fpm_service_name = 'php5-fpm'
$fpm_checkconf_cmd = '/usr/sbin/php5-fpm -t --fpm-config %'
$ext_tool_enable = '/usr/sbin/php5enmod'
$ext_tool_query = '/usr/sbin/php5query'
$package_prefix = 'php5-'
Expand Down

0 comments on commit 2a6184c

Please sign in to comment.