Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 88b1348

Browse files
committedJun 3, 2024
drop support for versions < 1.15.0, set default version to 1.16.0
1 parent bbfff0a commit 88b1348

File tree

10 files changed

+17
-76
lines changed

10 files changed

+17
-76
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ nginx::nginx_upstreams:
262262
263263
## Nginx with precompiled Passenger
264264
265-
Example configuration for Debian and RHEL / CentOS (>6), pulling the Nginx and
265+
Example configuration for Debian and RHEL / CentOS, pulling the Nginx and
266266
Passenger packages from the Phusion repo. See additional notes in
267267
[https://github.com/voxpupuli/puppet-nginx/blob/master/docs/quickstart.md](https://github.com/voxpupuli/puppet-nginx/blob/master/docs/quickstart.md)
268268

‎REFERENCE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ Data type: `String[1]`
277277
The version of nginx installed (or being installed).
278278
Unfortunately, different versions of nginx may need configuring
279279
differently. The default is derived from the version of nginx
280-
already installed. If the fact is unavailable, it defaults to '1.6.0'.
280+
already installed. If the fact is unavailable, it defaults to '1.16.0'.
281281
You may need to set this manually to get a working and idempotent
282282
configuration.
283283

284-
Default value: `pick(fact('nginx_version'), '1.6.0')`
284+
Default value: `pick(fact('nginx_version'), '1.16.0')`
285285

286286
##### <a name="-nginx--debug_connections"></a>`debug_connections`
287287

‎manifests/init.pp

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# The version of nginx installed (or being installed).
2121
# Unfortunately, different versions of nginx may need configuring
2222
# differently. The default is derived from the version of nginx
23-
# already installed. If the fact is unavailable, it defaults to '1.6.0'.
23+
# already installed. If the fact is unavailable, it defaults to '1.16.0'.
2424
# You may need to set this manually to get a working and idempotent
2525
# configuration.
2626
#
@@ -240,7 +240,7 @@
240240
Hash $nginx_upstreams = {},
241241
Nginx::UpstreamDefaults $nginx_upstreams_defaults = {},
242242
Boolean $purge_passenger_repo = true,
243-
String[1] $nginx_version = pick(fact('nginx_version'), '1.6.0'),
243+
String[1] $nginx_version = pick(fact('nginx_version'), '1.16.0'),
244244

245245
### END Hiera Lookups ###
246246
) inherits nginx::params {
@@ -251,6 +251,9 @@
251251
deprecation('keepalive_requests', 'Passing a String is deprecated, please pass a Integer')
252252
}
253253

254+
if versioncmp($nginx_version, '1.15.0') < 0 {
255+
fail("nginx::nginx_version must be at least 1.15.0, got ${nginx_version}")
256+
}
254257
contain 'nginx::package'
255258
contain 'nginx::config'
256259
contain 'nginx::service'

‎spec/acceptance/nginx_mail_spec.rb

-40
Original file line numberDiff line numberDiff line change
@@ -79,45 +79,5 @@ class { 'nginx':
7979
describe port(465) do
8080
it { is_expected.to be_listening }
8181
end
82-
83-
context 'when configured for nginx 1.14' do
84-
it 'runs successfully' do
85-
pp = "
86-
if fact('os.family') == 'RedHat' {
87-
package { 'nginx-mod-mail':
88-
ensure => installed,
89-
}
90-
}
91-
92-
class { 'nginx':
93-
mail => true,
94-
nginx_version => '1.14.0',
95-
dynamic_modules => fact('os.family') ? {
96-
'RedHat' => ['/usr/lib64/nginx/modules/ngx_mail_module.so'],
97-
default => [],
98-
}
99-
}
100-
nginx::resource::mailhost { 'domain1.example':
101-
ensure => present,
102-
auth_http => 'localhost/cgi-bin/auth',
103-
protocol => 'smtp',
104-
listen_port => 587,
105-
ssl => true,
106-
ssl_port => 465,
107-
ssl_cert => '/etc/pki/tls/certs/blah.cert',
108-
ssl_key => '/etc/pki/tls/private/blah.key',
109-
xclient => 'off',
110-
}
111-
"
112-
113-
apply_manifest(pp, catch_failures: true)
114-
end
115-
116-
describe file('/etc/nginx/conf.mail.d/domain1.example.conf') do
117-
it 'does\'t contain `ssl` on `listen` line' do
118-
is_expected.to contain 'listen *:465;'
119-
end
120-
end
121-
end
12282
end
12383
end

‎spec/classes/nginx_spec.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
it { is_expected.to contain_nginx__resource__streamhost('streamhost1').with_proxy('streamproxy') }
3939
end
4040

41+
describe 'unsupported version' do
42+
let(:params) { { nginx_version: '1.14.0' } }
43+
44+
it { is_expected.to compile.and_raise_error(%r{nginx::nginx_version must be at least 1.15.0, got 1.14.0}) }
45+
end
46+
4147
context 'nginx::package' do
4248
it { is_expected.to compile.with_all_deps }
4349

@@ -189,13 +195,8 @@
189195
let(:params) { { package_source: 'passenger' } }
190196

191197
it { is_expected.to contain_package('nginx') }
198+
it { is_expected.to contain_package('libnginx-mod-http-passenger') }
192199

193-
if (facts.dig(:os, 'name') == 'Debian' && %w[11].include?(facts.dig(:os, 'release', 'major'))) ||
194-
(facts.dig(:os, 'name') == 'Ubuntu' && %w[bionic focal jammy].include?(facts.dig(:os, 'distro', 'codename')))
195-
it { is_expected.to contain_package('libnginx-mod-http-passenger') }
196-
else
197-
it { is_expected.to contain_package('passenger') }
198-
end
199200
it do
200201
is_expected.to contain_apt__source('nginx').with(
201202
'location' => 'https://oss-binaries.phusionpassenger.com/apt/passenger',

‎spec/defines/resource_mailhost_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@
548548
title: 'should set the IPv4 SSL listen port',
549549
attr: 'ssl_port',
550550
value: 45,
551-
match: ' listen *:45;'
551+
match: ' listen *:45 ssl;'
552552
},
553553
{
554554
title: 'should enable IPv6',

‎spec/defines/resource_server_spec.rb

-14
Original file line numberDiff line numberDiff line change
@@ -667,20 +667,6 @@
667667
)
668668
end
669669

670-
context 'without a value for the nginx_version fact do' do
671-
let :facts do
672-
facts[:nginx_version] ? facts.delete(:nginx_version) : facts
673-
end
674-
675-
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{ ssl on;}) }
676-
end
677-
678-
context 'with fact nginx_version=1.14.1' do
679-
let(:facts) { facts.merge(nginx_version: '1.14.1') }
680-
681-
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{ ssl on;}) }
682-
end
683-
684670
context 'with fact nginx_version=1.15.1' do
685671
let(:facts) { facts.merge(nginx_version: '1.15.1') }
686672

‎templates/mailhost/mailhost.epp

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ server {
2323
<%- } -%>
2424
<%= $mailhost_common -%>
2525

26-
<%- if versioncmp($nginx_version, '1.15.0') < 0 { -%>
27-
ssl off;
28-
<% } %>
2926
starttls <%= $starttls %>;
3027

3128
<% if $starttls != 'off' { %>

‎templates/mailhost/mailhost_ssl.epp

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414
server {
1515
<%= $mailhost_prepend -%>
1616
<%- $listen_ip.each |$ip| { -%>
17-
listen <%= $ip %>:<%= $ssl_port %><% if versioncmp($nginx_version, '1.15.0') >= 0 { %> ssl<% } %>;
17+
listen <%= $ip %>:<%= $ssl_port %> ssl;
1818
<%- } -%>
1919
<%- $ipv6_listen_ip.each |$ipv6| { -%>
2020
listen [<%= $ipv6 %>]:<%= $ssl_port %> <% if $ipv6_listen_options { %><%= $ipv6_listen_options %><% } %>;
2121
<%- } -%>
2222
<%= $mailhost_common -%>
2323

24-
<%- if versioncmp($nginx_version, '1.15.0') < 0 { -%>
25-
ssl on;
26-
<% } %>
2724
starttls off;
2825

2926
<%= $mailhost_ssl_settings -%>

‎templates/server/server_ssl_settings.erb

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
<% if scope.call_function('versioncmp', [scope['nginx::nginx_version'], '1.15.0']) < 0 -%>
2-
ssl on;
3-
<% end -%>
41
<% if scope.call_function('versioncmp', [scope['nginx::nginx_version'], '1.25.1']) >= 0 && @http2 -%>
52
http2 <%= @http2 %>;
63
<% end -%>

0 commit comments

Comments
 (0)