Skip to content

Commit

Permalink
Merge pull request voxpupuli#1022 from wyardley/issues_1015
Browse files Browse the repository at this point in the history
warn if $ssl=false but $ssl_port == $listen_port (voxpupuli#1015)
  • Loading branch information
wyardley authored Apr 13, 2017
2 parents c228efa + f5c8409 commit f541430
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@
}
}

# Try to error in the case where the user sets ssl_port == listen_port but
# doesn't set ssl = true
if (!($ssl == true) and ($ssl_port == $listen_port)) {
warning('nginx: ssl must be true if listen_port is the same as ssl_port')
}

concat { $config_file:
owner => $owner,
group => $group,
Expand Down
10 changes: 6 additions & 4 deletions spec/defines/resource_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1029,14 +1029,16 @@
it { is_expected.to contain_file('/etc/nginx/uwsgi_params').with_mode('0644') }
end

context 'when listen_port == ssl_port' do
context 'when listen_port == ssl_port but ssl = false' do
let :params do
default_params.merge(listen_port: 80,
ssl_port: 80)
ssl_port: 80,
ssl: false)
end

it { is_expected.not_to contain_concat__fragment("#{title}-header") }
it { is_expected.not_to contain_concat__fragment("#{title}-footer") }
# TODO: implement test after this can be tested
# msg = %r{nginx: ssl must be true if listen_port is the same as ssl_port}
it 'Testing for warnings not yet implemented in classes'
end

context 'when listen_port != ssl_port' do
Expand Down

0 comments on commit f541430

Please sign in to comment.