diff --git a/manifests/resource/server.pp b/manifests/resource/server.pp index f8ab7e015..9f0caf653 100644 --- a/manifests/resource/server.pp +++ b/manifests/resource/server.pp @@ -354,6 +354,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, diff --git a/spec/defines/resource_server_spec.rb b/spec/defines/resource_server_spec.rb index de588f14a..51dd74102 100644 --- a/spec/defines/resource_server_spec.rb +++ b/spec/defines/resource_server_spec.rb @@ -990,14 +990,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