From ce2bd7f0689aaa16272f6e010e8d3a07b6bb5f6b Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Sat, 31 May 2014 16:06:23 +0200 Subject: [PATCH] add option for multi_accept and events_use --- manifests/config.pp | 2 ++ manifests/init.pp | 6 ++++++ templates/conf.d/nginx.conf.erb | 10 +++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index daf0307..f8346ec 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -17,6 +17,8 @@ class nginx::config( $worker_processes = $nginx::params::nx_worker_processes, $worker_connections = $nginx::params::nx_worker_connections, $worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile, + $multi_accept = $nginx::params::nx_multi_accept, + $events_use = $nginx::params::nx_events_use, $confd_purge = $nginx::params::nx_confd_purge, $vhost_purge = $nginx::params::nx_vhost_purge, $server_tokens = $nginx::params::nx_server_tokens, diff --git a/manifests/init.pp b/manifests/init.pp index 59395e9..09c8abf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -32,6 +32,8 @@ class nginx ( $worker_processes = $nginx::params::nx_worker_processes, $worker_connections = $nginx::params::nx_worker_connections, $worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile, + $multi_accept = $nginx::params::nx_multi_accept, + $events_use = $nginx::params::nx_events_use, $package_name = $nginx::params::package_name, $package_ensure = $nginx::params::package_ensure, $package_source = $nginx::params::package_source, @@ -87,6 +89,8 @@ class nginx ( if (!is_integer($worker_rlimit_nofile)) { fail('$worker_rlimit_nofile must be an integer.') } + validate_string($events_use) + validate_string($multi_accept) validate_string($package_name) validate_string($package_ensure) validate_string($package_source) @@ -157,6 +161,8 @@ class nginx ( worker_processes => $worker_processes, worker_connections => $worker_connections, worker_rlimit_nofile => $worker_rlimit_nofile, + multi_accept => $multi_accept, + events_use => $events_use, proxy_set_header => $proxy_set_header, proxy_http_version => $proxy_http_version, proxy_cache_path => $proxy_cache_path, diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index a3d4206..0ad6838 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -6,9 +6,13 @@ error_log <%= @nginx_error_log %>; <% if scope.lookupvar('nginx::params::nx_pid') != false %>pid <%= scope.lookupvar('nginx::params::nx_pid')%>;<% end -%> events { - worker_connections <%= @worker_connections -%>; -<% if scope.lookupvar('nginx::params::nx_multi_accept') == 'on' %>multi_accept on;<% end -%> -<% if scope.lookupvar('nginx::params::nx_events_use') %>use <%= scope.lookupvar('nginx::params::nx_events_use')%>;<% end -%> + worker_connections <%= @worker_connections -%>; + <% if @multi_accept == 'on' -%> + multi_accept on; + <% end -%> + <% if @events_use -%> + use <%= @events_use %>; + <% end -%> } http {