added nginx_vhosts_defaults parameter hash

This commit is contained in:
Frederik Wagner 2014-08-20 14:55:41 +02:00 committed by Matthew Haughton
parent 331338abdb
commit ad391f67bf
2 changed files with 9 additions and 5 deletions

View file

@ -62,6 +62,7 @@ class nginx (
$nginx_mailhosts = {},
$nginx_upstreams = {},
$nginx_vhosts = {},
$nginx_vhosts_defaults = {},
$package_ensure = $nginx::params::package_ensure,
$package_name = $nginx::params::package_name,
$package_source = $nginx::params::package_source,
@ -173,6 +174,7 @@ class nginx (
validate_string($http_access_log)
validate_hash($nginx_upstreams)
validate_hash($nginx_vhosts)
validate_hash($nginx_vhosts_defaults)
validate_hash($nginx_locations)
validate_hash($nginx_mailhosts)
validate_bool($manage_repo)
@ -261,7 +263,7 @@ class nginx (
}
create_resources('nginx::resource::upstream', $nginx_upstreams)
create_resources('nginx::resource::vhost', $nginx_vhosts)
create_resources('nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
create_resources('nginx::resource::location', $nginx_locations)
create_resources('nginx::resource::mailhost', $nginx_mailhosts)
create_resources('nginx::resource::map', $string_mappings)

View file

@ -3,10 +3,11 @@ require 'spec_helper'
describe 'nginx' do
let :params do
{
:nginx_upstreams => { 'upstream1' => { 'members' => ['localhost:3000']} },
:nginx_vhosts => { 'test2.local' => { 'www_root' => '/' } },
:nginx_locations => { 'test2.local' => { 'vhost' => 'test2.local', 'www_root' => '/'} },
:nginx_mailhosts => { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587} }
:nginx_upstreams => { 'upstream1' => { 'members' => ['localhost:3000']} },
:nginx_vhosts => { 'test2.local' => { 'www_root' => '/' } },
:nginx_vhosts_defaults => { 'listen_options' => 'default_server' },
:nginx_locations => { 'test2.local' => { 'vhost' => 'test2.local', 'www_root' => '/'} },
:nginx_mailhosts => { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587} }
}
end
@ -23,6 +24,7 @@ describe 'nginx' do
it { is_expected.to contain_class("nginx::params") }
it { is_expected.to contain_nginx__resource__upstream("upstream1") }
it { is_expected.to contain_nginx__resource__vhost("test2.local") }
it { is_expected.to contain_nginx__resource__vhost("test2.local").with_listen_options('default_server') }
it { is_expected.to contain_nginx__resource__location("test2.local") }
it { is_expected.to contain_nginx__resource__mailhost("smtp.test2.local") }
end