Skip to content

Commit a696982

Browse files
use datatype array for 'listen.?' parameters
1 parent 911fb38 commit a696982

File tree

2 files changed

+64
-54
lines changed

2 files changed

+64
-54
lines changed

manifests/fpm/pool.pp

Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
# [*listen_mode*]
2626
#
2727
# [*listen_acl_users*]
28-
# When POSIX Access Control Lists are supported you can set them using this option.
29-
# When set, listen.owner and listen.group are ignored. Value is a comma separated
30-
# list of user names.
28+
# Array. When POSIX Access Control Lists are supported you can set them using
29+
# this option. When set, listen.owner and listen.group are ignored. Value is
30+
# an array of user names.
3131
#
3232
# [*listen_acl_groups*]
33-
# See listen_acl_users. Value is a comma separated list of group names.
33+
# See listen_acl_users. Value is an array of group names.
3434
#
3535
# [*user*]
3636
# The user that php-fpm should run as
@@ -129,52 +129,52 @@
129129
# '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d'
130130
#
131131
define php::fpm::pool (
132-
$ensure = 'present',
133-
$listen = '127.0.0.1:9000',
134-
$listen_backlog = '-1',
135-
$listen_allowed_clients = undef,
136-
$listen_owner = undef,
137-
$listen_group = undef,
138-
$listen_mode = undef,
139-
Optional[String[1]] $listen_acl_users = undef,
140-
Optional[String[1]] $listen_acl_groups = undef,
141-
$user = $php::fpm::config::user,
142-
$group = $php::fpm::config::group,
143-
Optional[String[1]] $apparmor_hat = undef,
144-
$pm = 'dynamic',
145-
$pm_max_children = '50',
146-
$pm_start_servers = '5',
147-
$pm_min_spare_servers = '5',
148-
$pm_max_spare_servers = '35',
149-
$pm_max_requests = '0',
150-
$pm_process_idle_timeout = '10s',
151-
$pm_status_path = undef,
152-
$ping_path = undef,
153-
$ping_response = 'pong',
154-
$access_log = undef,
155-
$access_log_format = '"%R - %u %t \"%m %r\" %s"',
156-
$request_terminate_timeout = '0',
157-
$request_slowlog_timeout = '0',
158-
$security_limit_extensions = undef,
159-
$slowlog = "/var/log/php-fpm/${name}-slow.log",
160-
$template = 'php/fpm/pool.conf.erb',
161-
$rlimit_files = undef,
162-
$rlimit_core = undef,
163-
$chroot = undef,
164-
$chdir = undef,
165-
$catch_workers_output = 'no',
166-
$include = undef,
167-
$env = [],
168-
$env_value = {},
169-
$clear_env = true,
170-
$options = {},
171-
$php_value = {},
172-
$php_flag = {},
173-
$php_admin_value = {},
174-
$php_admin_flag = {},
175-
$php_directives = [],
176-
$root_group = $php::params::root_group,
177-
Optional[Stdlib::Absolutepath] $base_dir = undef,
132+
$ensure = 'present',
133+
$listen = '127.0.0.1:9000',
134+
$listen_backlog = '-1',
135+
$listen_allowed_clients = undef,
136+
$listen_owner = undef,
137+
$listen_group = undef,
138+
$listen_mode = undef,
139+
Optional[Array[String[1]]] $listen_acl_users = undef,
140+
Optional[Array[String[1]]] $listen_acl_groups = undef,
141+
$user = $php::fpm::config::user,
142+
$group = $php::fpm::config::group,
143+
Optional[String[1]] $apparmor_hat = undef,
144+
$pm = 'dynamic',
145+
$pm_max_children = '50',
146+
$pm_start_servers = '5',
147+
$pm_min_spare_servers = '5',
148+
$pm_max_spare_servers = '35',
149+
$pm_max_requests = '0',
150+
$pm_process_idle_timeout = '10s',
151+
$pm_status_path = undef,
152+
$ping_path = undef,
153+
$ping_response = 'pong',
154+
$access_log = undef,
155+
$access_log_format = '"%R - %u %t \"%m %r\" %s"',
156+
$request_terminate_timeout = '0',
157+
$request_slowlog_timeout = '0',
158+
$security_limit_extensions = undef,
159+
$slowlog = "/var/log/php-fpm/${name}-slow.log",
160+
$template = 'php/fpm/pool.conf.erb',
161+
$rlimit_files = undef,
162+
$rlimit_core = undef,
163+
$chroot = undef,
164+
$chdir = undef,
165+
$catch_workers_output = 'no',
166+
$include = undef,
167+
$env = [],
168+
$env_value = {},
169+
$clear_env = true,
170+
$options = {},
171+
$php_value = {},
172+
$php_flag = {},
173+
$php_admin_value = {},
174+
$php_admin_flag = {},
175+
$php_directives = [],
176+
$root_group = $php::params::root_group,
177+
Optional[Stdlib::Absolutepath] $base_dir = undef,
178178
) {
179179
# The base class must be included first because it is used by parameter defaults
180180
if ! defined(Class['php']) {
@@ -196,6 +196,16 @@
196196
default => $php::fpm::package,
197197
}
198198

199+
# 'php-fpm' expects a comma separated list of user names
200+
if $listen_acl_users {
201+
$real_listen_acl_users = join(flatten($listen_acl_users).unique, ",")
202+
}
203+
204+
# 'php-fpm' expects a comma separated list of group names
205+
if $listen_acl_groups {
206+
$real_listen_acl_groups = join(flatten($listen_acl_groups).unique, ",")
207+
}
208+
199209
$pool_base_dir = pick_default($base_dir, $php::fpm::config::pool_base_dir, $php::params::fpm_pool_dir)
200210
if ($ensure == 'absent') {
201211
file { "${pool_base_dir}/${pool}.conf":

templates/fpm/pool.conf.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ listen.mode = <%= @listen_mode %>
3838
<% else -%>
3939
;listen.mode = 0660
4040
<% end -%>
41-
<% if @listen_acl_users -%>
42-
listen.acl_users = <%= @listen_acl_users %>
41+
<% if @real_listen_acl_users -%>
42+
listen.acl_users = <%= @real_listen_acl_users %>
4343
<% end -%>
44-
<% if @listen_acl_groups -%>
45-
listen.acl_groups = <%= @listen_acl_groups %>
44+
<% if @real_listen_acl_groups -%>
45+
listen.acl_groups = <%= @real_listen_acl_groups %>
4646
<% end -%>
4747

4848
; Unix user/group of processes

0 commit comments

Comments
 (0)