Allow using $http_cfg_append with list of lists

It should be possible to include array of arrays in order to have
duplicate configuration keys (when permitted), like:

    nginx::http_cfg_append:
        - [include, /etc/nginx/vhosts/*.ngx]
        - [include, /etc/nginx/vhosts/*/*.ngx]
This commit is contained in:
Motiejus Jakštys 2014-06-30 08:37:43 +02:00
parent e78ba1f265
commit 0a1dacf605
2 changed files with 14 additions and 2 deletions

View file

@ -162,8 +162,11 @@ class nginx (
validate_string($proxy_buffers)
validate_string($proxy_buffer_size)
if ($http_cfg_append != false) {
validate_hash($http_cfg_append)
if !is_hash($http_cfg_append) or !is_array($http_cfg_append) {
fail('$http_cfg_append must be either a hash or array')
}
}
validate_string($nginx_error_log)
validate_string($http_access_log)
validate_hash($nginx_upstreams)

View file

@ -204,7 +204,7 @@ describe 'nginx::config' do
:notmatch => / proxy_cache_path \/path\/to\/proxy\.cache levels=1 keys_zone=d2:100m max_size=500m inactive=20m;/,
},
{
:title => 'should contain ordered appended directives',
:title => 'should contain ordered appended directives from hash',
:attr => 'http_cfg_append',
:value => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'allow' => 'test value 3' },
:match => [
@ -213,6 +213,15 @@ describe 'nginx::config' do
' test2 test value 2;',
],
},
{
:title => 'should contain duplicate appended directives from list of hashes',
:attr => 'http_cfg_append',
:value => [[ 'allow', 'test value 1'], ['allow', 'test value 2' ]],
:match => [
' allow test value 1;',
' allow test value 2;',
],
},
{
:title => 'should set pid',
:attr => 'pid',