Skip to content

Commit 3bef534

Browse files
committed
refactor: remove RHEL 7 TODOs and fix mod_ssl spec
RHEL 7 is EOL. Simplify helpers by removing version guards. Replace commented-out mod_ssl spec with a working test.
1 parent fc0cac8 commit 3bef534

4 files changed

Lines changed: 17 additions & 42 deletions

File tree

libraries/helpers.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ def apache_mod_php_modulename
419419
when 'amazon'
420420
'php8_module'
421421
when 'rhel'
422-
# TODO: Remove when we no longer support RHEL 7
423-
node['platform_version'].to_i >= 8 ? 'php7_module' : 'php5_module'
422+
'php7_module'
424423
when 'debian'
425424
if platform?('debian') && node['platform_version'].to_i >= 12
426425
'php_module'
@@ -457,8 +456,7 @@ def apache_mod_php_filename
457456
'libphp7.0.so'
458457
end
459458
when 'rhel'
460-
# TODO: Remove when we no longer support RHEL 7
461-
node['platform_version'].to_i >= 8 ? 'libphp7.so' : 'libphp5.so'
459+
'libphp7.so'
462460
when 'suse'
463461
if platform?('opensuse') && node['platform_version'].to_f >= 15.5
464462
'mod_php8.so'
@@ -474,8 +472,7 @@ def apache_mod_wsgi_package
474472
when 'debian'
475473
'libapache2-mod-wsgi-py3'
476474
when 'rhel', 'fedora', 'amazon'
477-
# TODO: Remove when we no longer support RHEL 7
478-
node['platform_version'].to_i >= 8 ? 'python3-mod_wsgi' : 'mod_wsgi'
475+
'python3-mod_wsgi'
479476
when 'suse'
480477
'apache2-mod_wsgi-python3'
481478
end
@@ -490,8 +487,7 @@ def apache_mod_wsgi_filename
490487
end
491488

492489
def apache_mod_auth_cas_install_method
493-
# TODO: Simplify when we no longer support RHEL 7
494-
if (platform_family?('rhel') && node['platform_version'].to_i >= 8) || platform_family?('suse', 'fedora', 'amazon')
490+
if platform_family?('rhel', 'suse', 'fedora', 'amazon')
495491
'source'
496492
else
497493
'package'

spec/libraries/mod_auth_cas_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ class DummyClass < Chef::Node
2626
it { expect(subject.apache_mod_auth_cas_install_method).to eq 'source' }
2727
end
2828

29-
context 'redhat 7' do
30-
let(:platform_family) { 'rhel' }
31-
let(:platform_version) { '7' }
32-
it { expect(subject.apache_mod_auth_cas_install_method).to eq 'package' }
33-
end
34-
3529
context 'debian' do
3630
let(:platform_family) { 'debian' }
3731
let(:platform_version) { '11' }

spec/libraries/mod_wsgi_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ class DummyClass < Chef::Node
2020
it { expect(subject.apache_mod_wsgi_package).to eq 'python3-mod_wsgi' }
2121
end
2222

23-
context 'redhat 7' do
24-
let(:platform_family) { 'rhel' }
25-
let(:platform_version) { '7' }
26-
it { expect(subject.apache_mod_wsgi_package).to eq 'mod_wsgi' }
27-
end
28-
2923
context 'debian' do
3024
let(:platform_family) { 'debian' }
3125
let(:platform_version) { '11' }

spec/resources/mod_ssl_spec.rb

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
# frozen_string_literal: true
22

3-
# TODO: Fix
4-
# resource apt_package[mod_ssl] is configured to notify resource execute[generate-module-list] with action run
5-
# Commenting out due to some notification bug.
6-
73
require 'spec_helper'
84

9-
# describe 'apache2_mod_ssl' do
10-
# step_into :apache2_install, :apache2_mod_ssl
11-
# platform 'ubuntu'
12-
13-
# context 'mod_ssl' do
14-
# recipe do
15-
# apache2_install 'package'
16-
# apache2_mod_ssl 'default'
17-
# end
5+
describe 'apache2_mod_ssl' do
6+
step_into :apache2_mod_ssl
7+
platform 'ubuntu'
188

19-
# it 'outputs template correctly' do
20-
# stub_command('/usr/sbin/apache2ctl -t').and_return('OK')
9+
context 'mod_ssl default' do
10+
recipe do
11+
apache2_mod_ssl 'default'
12+
end
2113

22-
# is_expected.not_to render_file('/etc/apache2/mods-available/ssl.conf')
23-
# .with_content(/SSLStrictSNIVHostCheck Off/)
14+
before do
15+
stub_command('/usr/sbin/apache2ctl -t').and_return('OK')
16+
end
2417

25-
# is_expected.to render_file('/etc/apache2/mods-available/ssl.conf')
26-
# .with_content(/SSLProtocol TLSv1.2/)
27-
# end
28-
# end
29-
# end
18+
it { is_expected.to create_template('/etc/apache2/mods-available/ssl.conf') }
19+
end
20+
end

0 commit comments

Comments
 (0)