Skip to content

Commit

Permalink
Merge pull request #369 from Motiejus/validate_hash
Browse files Browse the repository at this point in the history
Allow using $http_cfg_append with list of lists
  • Loading branch information
James Fryman committed Jul 1, 2014
2 parents e78ba1f + 0a1dacf commit e270b76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 10 additions & 1 deletion spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 => [
Expand All @@ -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',
Expand Down

0 comments on commit e270b76

Please sign in to comment.