Skip to content

Commit

Permalink
raise default version to 1.16.0
Browse files Browse the repository at this point in the history
this fixes the acceptance tests. But there is a bigger issue here.
The code in manifests/init.pp is not idempotent:
```
 String[1] $nginx_version                                = pick(fact('nginx_version'), '1.6.0'),
```
Turns out on the first run the fact might not be set yet leading to a pre 1.15.0 compatible
configuration on systems wich ship a newer version of nginx. Leading to
```
nginx: [emerg] unknown directive "ssl" in /etc/nginx/sites-enabled/www.puppetlabs.com.conf:25
```
  • Loading branch information
TheMeier committed Jun 3, 2024
1 parent bbfff0a commit 7e779c6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

--format documentation
--color
--fail-fast
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ already installed. If the fact is unavailable, it defaults to '1.6.0'.
You may need to set this manually to get a working and idempotent
configuration.

Default value: `pick(fact('nginx_version'), '1.6.0')`
Default value: `pick(fact('nginx_version'), '1.16.0')`

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

Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
Hash $nginx_upstreams = {},
Nginx::UpstreamDefaults $nginx_upstreams_defaults = {},
Boolean $purge_passenger_repo = true,
String[1] $nginx_version = pick(fact('nginx_version'), '1.6.0'),
String[1] $nginx_version = pick(fact('nginx_version'), '1.16.0'),

### END Hiera Lookups ###
) inherits nginx::params {
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/nginx_mail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class { 'nginx':
it { is_expected.to be_listening }
end

context 'when configured for nginx 1.14' do
context 'when configured for nginx 1.14', if: !%w[Debian Archlinux].include?(fact('os.family')) do
it 'runs successfully' do

Check failure on line 84 in spec/acceptance/nginx_mail_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - Rocky 8

nginx::resource::mailhost define: actualy test the mail module when configured for nginx 1.14 runs successfully Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'rocky8-64-puppet8.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_084030983.fVE2ba.pp Last 10 lines of output were: Jun 03 08:40:43 rocky8-64-puppet8.example.com nginx[3192]: nginx: configuration file /etc/nginx/nginx.conf test failed Jun 03 08:40:43 rocky8-64-puppet8.example.com systemd[1]: nginx.service: Control process exited, code=exited status=1 Jun 03 08:40:43 rocky8-64-puppet8.example.com systemd[1]: nginx.service: Failed with result 'exit-code'. Jun 03 08:40:43 rocky8-64-puppet8.example.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server. �[mNotice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh' from 1 event Info: Class[Nginx::Service]: Unscheduling all events on Class[Nginx::Service] Info: Class[Nginx]: Unscheduling all events on Class[Nginx] Info: Stage[main]: Unscheduling all events on Stage[main] �[mNotice: Applied catalog in 10.16 seconds

Check failure on line 84 in spec/acceptance/nginx_mail_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - Rocky 8

nginx::resource::mailhost define: actualy test the mail module when configured for nginx 1.14 runs successfully Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'rocky8-64-puppet7.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_084036463.vRV8JT.pp Last 10 lines of output were: Jun 03 08:40:47 rocky8-64-puppet7.example.com nginx[3203]: nginx: configuration file /etc/nginx/nginx.conf test failed Jun 03 08:40:47 rocky8-64-puppet7.example.com systemd[1]: nginx.service: Control process exited, code=exited status=1 Jun 03 08:40:47 rocky8-64-puppet7.example.com systemd[1]: nginx.service: Failed with result 'exit-code'. Jun 03 08:40:47 rocky8-64-puppet7.example.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server. �[mNotice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh' from 1 event Info: Class[Nginx::Service]: Unscheduling all events on Class[Nginx::Service] Info: Class[Nginx]: Unscheduling all events on Class[Nginx] Info: Stage[main]: Unscheduling all events on Stage[main] �[mNotice: Applied catalog in 9.28 seconds

Check failure on line 84 in spec/acceptance/nginx_mail_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - AlmaLinux 8

nginx::resource::mailhost define: actualy test the mail module when configured for nginx 1.14 runs successfully Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'almalinux8-64-puppet8.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_084024443.GNYInL.pp Last 10 lines of output were: Jun 03 08:40:31 almalinux8-64-puppet8.example.com nginx[3448]: nginx: configuration file /etc/nginx/nginx.conf test failed Jun 03 08:40:31 almalinux8-64-puppet8.example.com systemd[1]: nginx.service: Control process exited, code=exited status=1 Jun 03 08:40:31 almalinux8-64-puppet8.example.com systemd[1]: nginx.service: Failed with result 'exit-code'. Jun 03 08:40:31 almalinux8-64-puppet8.example.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server. �[mNotice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh' from 1 event Info: Class[Nginx::Service]: Unscheduling all events on Class[Nginx::Service] Info: Class[Nginx]: Unscheduling all events on Class[Nginx] Info: Stage[main]: Unscheduling all events on Stage[main] �[mNotice: Applied catalog in 5.39 seconds

Check failure on line 84 in spec/acceptance/nginx_mail_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - AlmaLinux 8

nginx::resource::mailhost define: actualy test the mail module when configured for nginx 1.14 runs successfully Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'almalinux8-64-puppet7.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_084028404.WpasPg.pp Last 10 lines of output were: Jun 03 08:40:35 almalinux8-64-puppet7.example.com nginx[3459]: nginx: configuration file /etc/nginx/nginx.conf test failed Jun 03 08:40:35 almalinux8-64-puppet7.example.com systemd[1]: nginx.service: Control process exited, code=exited status=1 Jun 03 08:40:35 almalinux8-64-puppet7.example.com systemd[1]: nginx.service: Failed with result 'exit-code'. Jun 03 08:40:35 almalinux8-64-puppet7.example.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server. �[mNotice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh' from 1 event Info: Class[Nginx::Service]: Unscheduling all events on Class[Nginx::Service] Info: Class[Nginx]: Unscheduling all events on Class[Nginx] Info: Stage[main]: Unscheduling all events on Stage[main] �[mNotice: Applied catalog in 5.88 seconds
pp = "
if fact('os.family') == 'RedHat' {
Expand Down
7 changes: 1 addition & 6 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,8 @@
let(:params) { { package_source: 'passenger' } }

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

if (facts.dig(:os, 'name') == 'Debian' && %w[11].include?(facts.dig(:os, 'release', 'major'))) ||
(facts.dig(:os, 'name') == 'Ubuntu' && %w[bionic focal jammy].include?(facts.dig(:os, 'distro', 'codename')))
it { is_expected.to contain_package('libnginx-mod-http-passenger') }
else
it { is_expected.to contain_package('passenger') }
end
it do
is_expected.to contain_apt__source('nginx').with(
'location' => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/resource_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
facts[:nginx_version] ? facts.delete(:nginx_version) : facts
end

it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{ ssl on;}) }
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{listen \*:443 ssl;}) }
end

context 'with fact nginx_version=1.14.1' do
Expand Down

0 comments on commit 7e779c6

Please sign in to comment.