Skip to content

Commit 83d077b

Browse files
authored
Merge pull request #2239 from puppetlabs/pdksync_GH-cat-12/main/add_redhat_9_support
pdksync - (GH-cat-12) Add Support for Redhat 9
2 parents 943dc9f + 12a3a36 commit 83d077b

14 files changed

+151
-117
lines changed

manifests/mod/authnz_ldap.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# The name of the ldap package.
99
#
1010
# @see https://httpd.apache.org/docs/current/mod/mod_authnz_ldap.html for additional documentation.
11-
# @note Unsupported platforms: RedHat: 6, 8; CentOS: 6, 8; OracleLinux: 6, 8; Ubuntu: all; Debian: all; SLES: all
11+
# @note Unsupported platforms: RedHat: 6, 8, 9; CentOS: 6, 8; OracleLinux: 6, 8; Ubuntu: all; Debian: all; SLES: all
1212
class apache::mod::authnz_ldap (
1313
Boolean $verify_server_cert = true,
1414
Optional[String] $package_name = undef,

manifests/mod/itk.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Used to verify that the Apache version you have requested is compatible with the module.
2929
#
3030
# @see http://mpm-itk.sesse.net for additional documentation.
31-
# @note Unsupported platforms: CentOS: 8; RedHat: 8; SLES: all
31+
# @note Unsupported platforms: CentOS: 8; RedHat: 8, 9; SLES: all
3232
class apache::mod::itk (
3333
Variant[String,Integer] $startservers = '8',
3434
Variant[String,Integer] $minspareservers = '5',

manifests/mod/ldap.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
# }
4848
#
4949
# @see https://httpd.apache.org/docs/current/mod/mod_ldap.html for additional documentation.
50-
# @note Unsupported platforms: CentOS: 8; RedHat: 8
50+
# @note Unsupported platforms: CentOS: 8; RedHat: 8, 9
5151
class apache::mod::ldap (
5252
Optional[String] $apache_version = undef,
5353
Optional[String] $package_name = undef,

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
$suphp_engine = 'off'
205205
$suphp_configpath = undef
206206
$php_version = $facts['os']['release']['major'] ? {
207+
'9' => '8', # RedHat9
207208
'8' => '7', # RedHat8
208209
default => '5', # RedHat5, RedHat6, RedHat7
209210
}

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"operatingsystemrelease": [
2424
"6",
2525
"7",
26-
"8"
26+
"8",
27+
"9"
2728
]
2829
},
2930
{

spec/acceptance/apache_parameters_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,10 @@ class { 'apache':
430430
pp = <<-MANIFEST
431431
if $::osfamily == 'RedHat' and "$::selinux" == "true" {
432432
$semanage_package = $::operatingsystemmajrelease ? {
433-
'5' => 'policycoreutils',
434-
'8' => 'policycoreutils-python-utils',
435-
default => 'policycoreutils-python',
433+
'6' => 'policycoreutils-python',
434+
'7' => 'policycoreutils-python',
435+
default => 'policycoreutils-python-utils',
436436
}
437-
438437
package { $semanage_package: ensure => installed }
439438
exec { 'set_apache_defaults':
440439
command => 'semanage fcontext -a -t httpd_log_t "/apache_spec(/.*)?"',

spec/acceptance/apache_ssl_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class { 'apache':
2323

2424
describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do
2525
it { is_expected.to be_file }
26-
if os[:family].include?('redhat') && os[:release].to_i == 8
26+
if os[:family].include?('redhat') && os[:release].to_i >= 8
2727
it { is_expected.to contain 'SSLProtocol all' }
2828
else
2929
it { is_expected.to contain 'SSLProtocol all -SSLv2 -SSLv3' }

spec/acceptance/class_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@
4343
<<-MANIFEST
4444
if $::osfamily == 'RedHat' and "$::selinux" == "true" {
4545
$semanage_package = $::operatingsystemmajrelease ? {
46-
'5' => 'policycoreutils',
47-
'8' => 'policycoreutils-python-utils',
48-
default => 'policycoreutils-python',
46+
'6' => 'policycoreutils-python',
47+
'7' => 'policycoreutils-python',
48+
default => 'policycoreutils-python-utils',
4949
}
50-
5150
package { $semanage_package: ensure => installed }
5251
exec { 'set_apache_defaults':
5352
command => 'semanage fcontext -a -t httpd_sys_content_t "/apache_spec(/.*)?"',

spec/acceptance/default_mods_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
apache_hash = apache_settings_hash
55
describe 'apache::default_mods class' do
66
describe 'no default mods' do
7-
# Using puppet_apply as a helper
87
let(:pp) do
98
<<-MANIFEST
109
class { 'apache':
@@ -23,7 +22,6 @@ class { 'apache':
2322
end
2423

2524
describe 'alternative default mods' do
26-
# Using puppet_apply as a helper
2725
let(:pp) do
2826
<<-MANIFEST
2927
class { 'apache':

spec/acceptance/mod_php_spec.rb

Lines changed: 88 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,101 @@
33
require 'spec_helper_acceptance'
44
apache_hash = apache_settings_hash
55

6-
describe 'apache::mod::php class', if: mod_supported_on_platform?('apache::mod::php') do
7-
context 'default php config' do
8-
pp = <<-MANIFEST
9-
class { 'apache':
10-
mpm_module => 'prefork',
11-
}
12-
class { 'apache::mod::php': }
13-
apache::vhost { 'php.example.com':
14-
port => '80',
15-
docroot => '#{apache_hash['doc_root']}/php',
16-
}
17-
host { 'php.example.com': ip => '127.0.0.1', }
18-
file { '#{apache_hash['doc_root']}/php/index.php':
19-
ensure => file,
20-
content => "<?php phpinfo(); ?>\\n",
21-
}
22-
MANIFEST
23-
it 'succeeds in puppeting php' do
24-
apply_manifest(pp, catch_failures: true)
25-
end
26-
27-
if os[:family] == 'debian' && os[:release] =~ %r{^9\.}
28-
describe file("#{apache_hash['mod_dir']}/php7.0.conf") do
29-
it { is_expected.to contain 'DirectoryIndex index.php' }
30-
end
31-
elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.}
32-
describe file("#{apache_hash['mod_dir']}/php7.3.conf") do
33-
it { is_expected.to contain 'DirectoryIndex index.php' }
34-
end
35-
elsif os[:family] == 'debian' && os[:release] =~ %r{^11\.}
36-
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
37-
it { is_expected.to contain 'DirectoryIndex index.php' }
38-
end
39-
elsif os[:family] == 'ubuntu' && os[:release] == '18.04'
40-
describe file("#{apache_hash['mod_dir']}/php7.2.conf") do
41-
it { is_expected.to contain 'DirectoryIndex index.php' }
42-
end
43-
elsif os[:family] == 'ubuntu' && os[:release] == '20.04'
44-
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
45-
it { is_expected.to contain 'DirectoryIndex index.php' }
6+
# Temporary exclusion pending resolution of https://github.com/puppetlabs/puppetlabs-apache/issues/2261
7+
unless os[:family] == 'redhat' && os[:release].to_i == 9
8+
describe 'apache::mod::php class', if: mod_supported_on_platform?('apache::mod::php') do
9+
context 'default php config' do
10+
pp = <<-MANIFEST
11+
class { 'apache':
12+
mpm_module => 'prefork',
13+
}
14+
class { 'apache::mod::php': }
15+
apache::vhost { 'php.example.com':
16+
port => '80',
17+
docroot => '#{apache_hash['doc_root']}/php',
18+
}
19+
host { 'php.example.com': ip => '127.0.0.1', }
20+
file { '#{apache_hash['doc_root']}/php/index.php':
21+
ensure => file,
22+
content => "<?php phpinfo(); ?>\\n",
23+
}
24+
MANIFEST
25+
it 'succeeds in puppeting php' do
26+
apply_manifest(pp, catch_failures: true)
4627
end
47-
elsif os[:family] == 'redhat' && os[:release] =~ %r{^8\b}
48-
describe file("#{apache_hash['mod_dir']}/php7.conf") do
49-
it { is_expected.to contain 'DirectoryIndex index.php' }
50-
end
51-
elsif os[:family] == 'sles' && os[:release].to_i >= 15
52-
describe file("#{apache_hash['mod_dir']}/php7.conf") do
53-
it { is_expected.to contain 'DirectoryIndex index.php' }
54-
end
55-
else
56-
describe file("#{apache_hash['mod_dir']}/php5.conf") do
57-
it { is_expected.to contain 'DirectoryIndex index.php' }
28+
29+
if os[:family] == 'debian' && os[:release] =~ %r{^9\.}
30+
describe file("#{apache_hash['mod_dir']}/php7.0.conf") do
31+
it { is_expected.to contain 'DirectoryIndex index.php' }
32+
end
33+
elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.}
34+
describe file("#{apache_hash['mod_dir']}/php7.3.conf") do
35+
it { is_expected.to contain 'DirectoryIndex index.php' }
36+
end
37+
elsif os[:family] == 'debian' && os[:release] =~ %r{^11\.}
38+
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
39+
it { is_expected.to contain 'DirectoryIndex index.php' }
40+
end
41+
elsif os[:family] == 'ubuntu' && os[:release] == '18.04'
42+
describe file("#{apache_hash['mod_dir']}/php7.2.conf") do
43+
it { is_expected.to contain 'DirectoryIndex index.php' }
44+
end
45+
elsif os[:family] == 'ubuntu' && os[:release] == '20.04'
46+
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
47+
it { is_expected.to contain 'DirectoryIndex index.php' }
48+
end
49+
elsif os[:family] == 'redhat' && os[:release] =~ %r{^(9)\b}
50+
describe file("#{apache_hash['mod_dir']}/php.conf") do
51+
it { is_expected.to contain 'DirectoryIndex index.php' }
52+
end
53+
elsif os[:family] == 'redhat' && os[:release] =~ %r{^(8)\b}
54+
describe file("#{apache_hash['mod_dir']}/php7.conf") do
55+
it { is_expected.to contain 'DirectoryIndex index.php' }
56+
end
57+
elsif os[:family] == 'sles' && os[:release].to_i >= 15
58+
describe file("#{apache_hash['mod_dir']}/php7.conf") do
59+
it { is_expected.to contain 'DirectoryIndex index.php' }
60+
end
61+
else
62+
describe file("#{apache_hash['mod_dir']}/php5.conf") do
63+
it { is_expected.to contain 'DirectoryIndex index.php' }
64+
end
5865
end
5966
end
60-
end
6167

62-
context 'custom extensions, php_flag, php_value, php_admin_flag, and php_admin_value' do
63-
pp = <<-MANIFEST
64-
class { 'apache':
65-
mpm_module => 'prefork',
68+
context 'custom extensions, php_flag, php_value, php_admin_flag, and php_admin_value' do
69+
pp = <<-MANIFEST
70+
class { 'apache':
71+
mpm_module => 'prefork',
72+
}
73+
class { 'apache::mod::php':
74+
extensions => ['.php','.php5'],
6675
}
67-
class { 'apache::mod::php':
68-
extensions => ['.php','.php5'],
69-
}
7076
71-
apache::vhost { 'php.example.com':
72-
port => '80',
73-
docroot => '#{apache_hash['doc_root']}/php',
74-
php_values => { 'include_path' => '.:/usr/share/pear:/usr/bin/php', },
75-
php_flags => { 'display_errors' => 'on', },
76-
php_admin_values => { 'open_basedir' => '/var/www/php/:/usr/share/pear/', },
77-
php_admin_flags => { 'engine' => 'on', },
78-
}
79-
host { 'php.example.com': ip => '127.0.0.1', }
80-
file { '#{apache_hash['doc_root']}/php/index.php5':
81-
ensure => file,
82-
content => "<?php phpinfo(); ?>\\n",
83-
}
84-
MANIFEST
85-
it 'succeeds in puppeting php' do
86-
apply_manifest(pp, catch_failures: true)
87-
end
77+
apache::vhost { 'php.example.com':
78+
port => '80',
79+
docroot => '#{apache_hash['doc_root']}/php',
80+
php_values => { 'include_path' => '.:/usr/share/pear:/usr/bin/php', },
81+
php_flags => { 'display_errors' => 'on', },
82+
php_admin_values => { 'open_basedir' => '/var/www/php/:/usr/share/pear/', },
83+
php_admin_flags => { 'engine' => 'on', },
84+
}
85+
host { 'php.example.com': ip => '127.0.0.1', }
86+
file { '#{apache_hash['doc_root']}/php/index.php5':
87+
ensure => file,
88+
content => "<?php phpinfo(); ?>\\n",
89+
}
90+
MANIFEST
91+
it 'succeeds in puppeting php' do
92+
apply_manifest(pp, catch_failures: true)
93+
end
8894

89-
describe file("#{apache_hash['vhost_dir']}/25-php.example.com.conf") do
90-
it { is_expected.to contain ' php_flag display_errors on' }
91-
it { is_expected.to contain ' php_value include_path ".:/usr/share/pear:/usr/bin/php"' }
92-
it { is_expected.to contain ' php_admin_flag engine on' }
93-
it { is_expected.to contain ' php_admin_value open_basedir /var/www/php/:/usr/share/pear/' }
95+
describe file("#{apache_hash['vhost_dir']}/25-php.example.com.conf") do
96+
it { is_expected.to contain ' php_flag display_errors on' }
97+
it { is_expected.to contain ' php_value include_path ".:/usr/share/pear:/usr/bin/php"' }
98+
it { is_expected.to contain ' php_admin_flag engine on' }
99+
it { is_expected.to contain ' php_admin_value open_basedir /var/www/php/:/usr/share/pear/' }
100+
end
94101
end
95102
end
96103
end

spec/acceptance/prefork_worker_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class { 'apache':
4747

4848
describe 'apache::mod::prefork class' do
4949
describe 'running puppet code' do
50-
# Using puppet_apply as a helper
5150
let(:pp) do
5251
<<-MANIFEEST
5352
class { 'apache':

spec/acceptance/vhost_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class { 'apache': }
5151
end
5252
end
5353

54-
context 'default vhost with ssl', unless: (os[:family].include?('redhat') && os[:release].to_i == 8) do
54+
context 'default vhost with ssl', unless: (os[:family].include?('redhat') && os[:release].to_i >= 8) do
5555
pp = <<-MANIFEST
5656
file { '#{apache_hash['run_dir']}':
5757
ensure => 'directory',
@@ -1188,9 +1188,9 @@ class { 'apache::mod::wsgi': }
11881188
pp = <<-MANIFEST
11891189
if $::osfamily == 'RedHat' and "$::selinux" == "true" {
11901190
$semanage_package = $::operatingsystemmajrelease ? {
1191-
'5' => 'policycoreutils',
1192-
'8' => 'policycoreutils-python-utils',
1193-
default => 'policycoreutils-python',
1191+
'6' => 'policycoreutils-python',
1192+
'7' => 'policycoreutils-python',
1193+
default => 'policycoreutils-python-utils',
11941194
}
11951195
package { $semanage_package: ensure => installed }
11961196
exec { 'set_apache_defaults':

spec/classes/mod/php_spec.rb

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,17 @@
100100
end
101101

102102
it { is_expected.to contain_class('apache::params') }
103-
it { is_expected.to contain_apache__mod('php5') } if facts[:os]['release']['major'].to_i < 8
104-
it { is_expected.to contain_package('php') } if facts[:os]['release']['major'].to_i > 5
105-
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } if facts[:os]['release']['major'].to_i < 8
106-
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") } if facts[:os]['release']['major'].to_i >= 8
103+
it { is_expected.to contain_package('php') }
104+
if facts[:os]['release']['major'].to_i < 8
105+
it { is_expected.to contain_apache__mod('php5') }
106+
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") }
107+
elsif facts[:os]['release']['major'].to_i == 8
108+
it { is_expected.to contain_apache__mod('php7') }
109+
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") }
110+
elsif facts[:os]['release']['major'].to_i >= 9
111+
it { is_expected.to contain_apache__mod('php') }
112+
it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module modules/libphp.so\n") }
113+
end
107114
end
108115
context 'with alternative package name' do
109116
let :pre_condition do
@@ -123,8 +130,17 @@
123130
{ path: 'alternative-path' }
124131
end
125132

126-
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module alternative-path\n") } if facts[:os]['release']['major'].to_i < 8
127-
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module alternative-path\n") } if facts[:os]['release']['major'].to_i >= 8
133+
it { is_expected.to contain_package('php') }
134+
if facts[:os]['release']['major'].to_i < 8
135+
it { is_expected.to contain_apache__mod('php5') }
136+
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module alternative-path\n") }
137+
elsif facts[:os]['release']['major'].to_i == 8
138+
it { is_expected.to contain_apache__mod('php7') }
139+
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module alternative-path\n") }
140+
elsif facts[:os]['release']['major'].to_i >= 9
141+
it { is_expected.to contain_apache__mod('php') }
142+
it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module alternative-path\n") }
143+
end
128144
end
129145
context 'with alternative extensions' do
130146
let :pre_condition do
@@ -157,10 +173,17 @@
157173
context 'with mpm_module => prefork' do
158174
it { is_expected.to contain_class('apache::params') }
159175
it { is_expected.to contain_class('apache::mod::prefork') }
160-
it { is_expected.to contain_apache__mod('php5') } if facts[:os]['release']['major'].to_i < 8
161-
it { is_expected.to contain_package('php') } if facts[:os]['release']['major'].to_i > 5
162-
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } if facts[:os]['release']['major'].to_i < 8
163-
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") } if facts[:os]['release']['major'].to_i >= 8
176+
it { is_expected.to contain_package('php') }
177+
if facts[:os]['release']['major'].to_i < 8
178+
it { is_expected.to contain_apache__mod('php5') }
179+
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") }
180+
elsif facts[:os]['release']['major'].to_i == 8
181+
it { is_expected.to contain_apache__mod('php7') }
182+
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") }
183+
elsif facts[:os]['release']['major'].to_i >= 9
184+
it { is_expected.to contain_apache__mod('php') }
185+
it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module modules/libphp.so\n") }
186+
end
164187
end
165188
context 'with mpm_module => itk' do
166189
let :pre_condition do
@@ -169,10 +192,17 @@
169192

170193
it { is_expected.to contain_class('apache::params') }
171194
it { is_expected.to contain_class('apache::mod::itk') }
172-
it { is_expected.to contain_apache__mod('php5') } if facts[:os]['release']['major'].to_i < 8
173-
it { is_expected.to contain_package('php') } if facts[:os]['release']['major'].to_i > 5
174-
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } if facts[:os]['release']['major'].to_i < 8
175-
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") } if facts[:os]['release']['major'].to_i >= 8
195+
it { is_expected.to contain_package('php') }
196+
if facts[:os]['release']['major'].to_i < 8
197+
it { is_expected.to contain_apache__mod('php5') }
198+
it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") }
199+
elsif facts[:os]['release']['major'].to_i == 8
200+
it { is_expected.to contain_apache__mod('php7') }
201+
it { is_expected.to contain_file('php7.load').with(content: "LoadModule php7_module modules/libphp7.so\n") }
202+
elsif facts[:os]['release']['major'].to_i >= 9
203+
it { is_expected.to contain_apache__mod('php') }
204+
it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module modules/libphp.so\n") }
205+
end
176206
end
177207
end
178208
when 'FreeBSD'

0 commit comments

Comments
 (0)