diff --git a/manifests/init.pp b/manifests/init.pp index fb414a62f..f1a172897 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -162,8 +162,11 @@ 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 902495e44..3434079ce 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -204,7 +204,7 @@ :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 @@ ' 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',