diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 3429e45e9..17751947f 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -40,6 +40,7 @@ # that you can split the script_name and path_info via regex # [*uwsgi*] - location of uwsgi (host:port) # [*uwsgi_params*] - optional alternative uwsgi_params file to use +# [*uwsgi_read_timeout*] - optional value for uwsgi_read_timeout # [*ssl*] - Indicates whether to setup SSL bindings for # this location. # [*ssl_only*] - Required if the SSL and normal vHost have the @@ -157,6 +158,7 @@ $fastcgi_split_path = undef, $uwsgi = undef, $uwsgi_params = "${nginx::config::conf_dir}/uwsgi_params", + $uwsgi_read_timeout = undef, $ssl = false, $ssl_only = false, $location_alias = undef, @@ -238,6 +240,9 @@ validate_string($uwsgi) } validate_string($uwsgi_params) + if ($uwsgi_read_timeout != undef) { + validate_string($uwsgi_read_timeout) + } validate_bool($internal) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 7fcf4dd10..e63a5043b 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -48,6 +48,7 @@ # [*fastcgi*] - location of fastcgi (host:port) # [*fastcgi_params*] - optional alternative fastcgi_params file to use # [*fastcgi_script*] - optional SCRIPT_FILE parameter +# [*uwsgi_read_timeout*] - optional value for uwsgi_read_timeout # [*ssl*] - Indicates whether to setup SSL bindings for this # vhost. # [*ssl_cert*] - Pre-generated SSL Certificate file to reference @@ -235,6 +236,7 @@ $fastcgi_script = undef, $uwsgi = undef, $uwsgi_params = "${nginx::config::conf_dir}/uwsgi_params", + $uwsgi_read_timeout = undef, $index_files = [ 'index.html', 'index.htm', @@ -418,6 +420,9 @@ validate_string($uwsgi) } validate_string($uwsgi_params) + if ($uwsgi_read_timeout != undef) { + validate_string($uwsgi_read_timeout) + } validate_array($index_files) if ($autoindex != undef) { validate_string($autoindex) @@ -619,6 +624,7 @@ fastcgi_script => $fastcgi_script, uwsgi => $uwsgi, uwsgi_params => $uwsgi_params, + uwsgi_read_timeout => $uwsgi_read_timeout, try_files => $try_files, www_root => $www_root, autoindex => $autoindex, diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index ade90dd73..444de037d 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -567,6 +567,12 @@ attr: 'uwsgi', value: 'value', match: %r{\s+uwsgi_pass\s+value;} + }, + { + title: 'should set uwsgi_read_timeout', + attr: 'uwsgi_read_timeout', + value: '300s', + match: %r{\s+uwsgi_read_timeout\s+300s;} } ].each do |param| context "when #{param[:attr]} is #{param[:value]}" do diff --git a/templates/vhost/locations/uwsgi.erb b/templates/vhost/locations/uwsgi.erb index a20cc4685..0cfb43b56 100644 --- a/templates/vhost/locations/uwsgi.erb +++ b/templates/vhost/locations/uwsgi.erb @@ -6,3 +6,6 @@ <% end -%> include <%= @uwsgi_params %>; uwsgi_pass <%= @uwsgi %>; +<% if @uwsgi_read_timeout-%> + uwsgi_read_timeout <%= @uwsgi_read_timeout %>; +<% end -%>