diff --git a/manifests/init.pp b/manifests/init.pp index fb414a6..f1a1728 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 902495e..3434079 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -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',