diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 3c1a979e..e69a7131 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -121,50 +121,50 @@ # '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' # define php::fpm::pool ( - Enum['present', 'absent'] $ensure = 'present', - String[1] $listen = '127.0.0.1:9000', - Integer[-1] $listen_backlog = -1, - Optional[String[1]] $listen_allowed_clients = undef, - Optional[String[1]] $listen_owner = undef, - Optional[String[1]] $listen_group = undef, - Optional[Stdlib::Filemode] $listen_mode = undef, - String[1] $user = $php::fpm::config::user, - String[1] $group = $php::fpm::config::group, - Optional[String[1]] $apparmor_hat = undef, - String[1] $pm = 'dynamic', - Integer[1] $pm_max_children = 50, - Integer[0] $pm_start_servers = 5, - Integer[0] $pm_min_spare_servers = 5, - Integer[0] $pm_max_spare_servers = 35, - Integer[0] $pm_max_requests = 0, - Php::Duration $pm_process_idle_timeout = '10s', - Optional[Stdlib::Absolutepath] $pm_status_path = undef, - Optional[Stdlib::Absolutepath] $ping_path = undef, - String[1] $ping_response = 'pong', - Optional[Stdlib::Absolutepath] $access_log = undef, - String[1] $access_log_format = '"%R - %u %t \"%m %r\" %s"', - Php::Duration $request_terminate_timeout = 0, - Php::Duration $request_slowlog_timeout = 0, - Array[String[1]] $security_limit_extensions = [], - Stdlib::Absolutepath $slowlog = "/var/log/php-fpm/${name}-slow.log", - String[1] $template = 'php/fpm/pool.conf.erb', - Optional[Integer] $rlimit_files = undef, - Optional[Integer] $rlimit_core = undef, - Optional[Stdlib::Absolutepath] $chroot = undef, - Optional[Stdlib::Absolutepath] $chdir = undef, - Enum['yes', 'no'] $catch_workers_output = 'no', - Optional[String[1]] $include = undef, - Array[String[1]] $env = [], - Hash $env_value = {}, - Boolean $clear_env = true, - Hash $options = {}, - Hash $php_value = {}, - Hash $php_flag = {}, - Hash $php_admin_value = {}, - Hash $php_admin_flag = {}, - Array[String[1]] $php_directives = [], - String[1] $root_group = $php::params::root_group, - Optional[Stdlib::Absolutepath] $base_dir = undef, + Enum['present', 'absent'] $ensure = 'present', + String[1] $listen = '127.0.0.1:9000', + Integer[-1] $listen_backlog = -1, + Optional[String[1]] $listen_allowed_clients = undef, + Optional[String[1]] $listen_owner = undef, + Optional[String[1]] $listen_group = undef, + Optional[Stdlib::Filemode] $listen_mode = undef, + String[1] $user = $php::fpm::config::user, + String[1] $group = $php::fpm::config::group, + Optional[String[1]] $apparmor_hat = undef, + String[1] $pm = 'dynamic', + Variant[Integer[1], Php::EnvString] $pm_max_children = 50, + Variant[Integer[0], Php::EnvString] $pm_start_servers = 5, + Variant[Integer[0], Php::EnvString] $pm_min_spare_servers = 5, + Variant[Integer[0], Php::EnvString] $pm_max_spare_servers = 35, + Variant[Integer[0], Php::EnvString] $pm_max_requests = 0, + Variant[Php::Duration, Php::EnvString] $pm_process_idle_timeout = '10s', + Optional[Stdlib::Absolutepath] $pm_status_path = undef, + Optional[Stdlib::Absolutepath] $ping_path = undef, + String[1] $ping_response = 'pong', + Optional[Stdlib::Absolutepath] $access_log = undef, + String[1] $access_log_format = '"%R - %u %t \"%m %r\" %s"', + Variant[Php::Duration, Php::EnvString] $request_terminate_timeout = 0, + Variant[Php::Duration, Php::EnvString] $request_slowlog_timeout = 0, + Array[String[1]] $security_limit_extensions = [], + Stdlib::Absolutepath $slowlog = "/var/log/php-fpm/${name}-slow.log", + String[1] $template = 'php/fpm/pool.conf.erb', + Optional[Integer] $rlimit_files = undef, + Optional[Integer] $rlimit_core = undef, + Optional[Stdlib::Absolutepath] $chroot = undef, + Optional[Stdlib::Absolutepath] $chdir = undef, + Enum['yes', 'no'] $catch_workers_output = 'no', + Optional[String[1]] $include = undef, + Array[String[1]] $env = [], + Hash $env_value = {}, + Boolean $clear_env = true, + Hash $options = {}, + Hash $php_value = {}, + Hash $php_flag = {}, + Hash $php_admin_value = {}, + Hash $php_admin_flag = {}, + Array[String[1]] $php_directives = [], + String[1] $root_group = $php::params::root_group, + Optional[Stdlib::Absolutepath] $base_dir = undef, ) { # The base class must be included first because it is used by parameter defaults if ! defined(Class['php']) { diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index d6bdd1f0..f1ac17c8 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -8,6 +8,24 @@ end let(:pre_condition) { 'include php' } + context 'with environment based config' do + let(:title) { 'env-config' } + let(:params) { { + pm_max_children: '${PM_MAX_CHILDREN}', + pm_start_servers: '${PM_START_SERVERS}', + pm_min_spare_servers: '${PM_MIN_SPARE_SERVERS}', + pm_max_spare_servers: '${PM_MAX_SPARE_SERVERS}', + pm_max_requests: '${PM_MAX_REQUESTS}', + pm_process_idle_timeout: '${PM_PROCESS_IDLE_TIMEOUT}', + request_terminate_timeout: '${REQUEST_TERMINATE_TIMEOUT}', + request_slowlog_timeout: '${REQUEST_SLOWLOG_TIMEOUT}', + } } + + it { + is_expected.to compile + } + end + case facts[:os]['name'] when 'Debian' context 'plain config' do diff --git a/types/envstring.pp b/types/envstring.pp new file mode 100644 index 00000000..e8bc9073 --- /dev/null +++ b/types/envstring.pp @@ -0,0 +1 @@ +type Php::EnvString = Pattern[/\$\{[\w]+\}/]