Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing stream dirs and create streams from hiera #879

Merged
merged 1 commit into from
Oct 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,33 @@
owner => $daemon_user,
}

if $stream {
file { "${conf_dir}/streams-available":
ensure => directory,
owner => $sites_available_owner,
group => $sites_available_group,
mode => $sites_available_mode,
}

if $vhost_purge == true {
File["${conf_dir}/streams-available"] {
purge => true,
recurse => true,
}
}

file { "${conf_dir}/streams-enabled":
ensure => directory,
}

if $vhost_purge == true {
File["${conf_dir}/streams-enabled"] {
purge => true,
recurse => true,
}
}
}

file { "${conf_dir}/sites-available":
ensure => directory,
owner => $sites_available_owner,
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
$string_mappings = {},
$nginx_locations = {},
$nginx_mailhosts = {},
$nginx_streamhosts = {},
$nginx_upstreams = {},
$nginx_vhosts = {},
$nginx_vhosts_defaults = {},
Expand Down Expand Up @@ -311,6 +312,7 @@
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::streamhost', $nginx_streamhosts)
create_resources('nginx::resource::map', $string_mappings)
create_resources('nginx::resource::geo', $geo_mappings)

Expand Down
6 changes: 6 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@
end
end

context 'when stream true' do
let(:params) { { stream: true } }
it { is_expected.to contain_file('/etc/nginx/streams-available') }
it { is_expected.to contain_file('/etc/nginx/streams-enabled') }
end

context 'when daemon_user = www-data' do
let(:params) { { daemon_user: 'www-data' } }
it { is_expected.to contain_file('/var/nginx/client_body_temp').with(owner: 'www-data') }
Expand Down
4 changes: 3 additions & 1 deletion spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
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 } }
nginx_mailhosts: { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587 } },
nginx_streamhosts: { 'streamhost1' => { 'proxy' => 'streamproxy' } }
}
end

Expand All @@ -32,5 +33,6 @@
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') }
it { is_expected.to contain_nginx__resource__streamhost('streamhost1').with_proxy('streamproxy') }
end
end