From 810d36d3a8988fa05a008100eab4e42a95552190 Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Wed, 1 Apr 2015 23:34:31 -0400 Subject: [PATCH] config: refined worker_processes validation Closes #540 --- manifests/config.pp | 2 +- spec/classes/config_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index d9516937a..af05844f4 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -94,7 +94,7 @@ ) inherits ::nginx::params { ### Validations ### - if (!is_string($worker_processes)) and (!is_integer($worker_processes)) { + if ($worker_processes != 'auto') and (!is_integer($worker_processes)) { fail('$worker_processes must be an integer or have value "auto".') } if (!is_integer($worker_connections)) { diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index e1108eae4..2a966af9a 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -76,6 +76,12 @@ :value => '4', :match => 'worker_processes 4;', }, + { + :title => 'should set worker_processes', + :attr => 'worker_processes', + :value => 'auto', + :match => 'worker_processes auto;', + }, { :title => 'should set worker_rlimit_nofile', :attr => 'worker_rlimit_nofile',