Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdksync - (GH-cat-11) Certify Support for Ubuntu 22.04 #2276

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions manifests/mod/php.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
}

include apache
if (versioncmp($php_version, '8') < 0) {
$mod = "php${php_version}"
} else {
# RedHat + PHP 8 drop the major version in apache module name.
if ($facts['os']['family'] == 'RedHat') and (versioncmp($php_version, '8') >= 0) {
$mod = 'php'
} else {
$mod = "php${php_version}"
}

if $apache::version::scl_httpd_version == undef and $apache::version::scl_php_version != undef {
Expand Down Expand Up @@ -92,12 +93,11 @@
$_php_version_no_dot = regsubst($php_version, '\.', '')
if $apache::version::scl_httpd_version {
$_lib = "librh-php${_php_version_no_dot}-php${_php_major}.so"
} elsif ($facts['os']['family'] == 'RedHat') and ($_php_major == 8) {
# RedHat + PHP 8 drop the major version in apache module name.
$_lib = "${libphp_prefix}.so"
} else {
# Controls php version and libphp prefix
$_lib = $_php_major ? {
'8' => "${libphp_prefix}.so",
default => "${libphp_prefix}${php_version}.so",
}
$_lib = "${libphp_prefix}${php_version}.so"
}
$_module_id = $_php_major ? {
'5' => 'php5_module',
Expand Down
20 changes: 10 additions & 10 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,16 @@
$default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
$default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key'
$ssl_sessioncache = "\${APACHE_RUN_DIR}/ssl_scache(512000)"
if ($facts['os']['name'] == 'Ubuntu') or ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') < 0) {
$php_version = $facts['os']['release']['major'] ? {
'9' => '7.0', # Debian Stretch
'10' => '7.3', # Debian Buster
'20.04' => '7.4', # Ubuntu Foccal Fossal
default => '7.2', # Ubuntu Bionic, Cosmic and Disco
}
$php_version = $facts['os']['release']['major'] ? {
'9' => '7.0', # Debian Stretch
'10' => '7.3', # Debian Buster
'11' => '7.4', # Debian Bullseye
'20.04' => '7.4', # Ubuntu Foccal Fossal
'22.04' => '8.1', # Ubuntu Jammy
default => '7.2', # Ubuntu Bionic, Cosmic and Disco
}
if (($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') < 0) or
($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') < 0)) {
Comment on lines +356 to +357
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did create os_version_gte for this in the past, but never got around to using it. If you want, you could rewrite the logic here. Be sure to use at least stdlib 8.1.0 then since that fixed the logic.

Copy link
Member Author

@david22swan david22swan Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While that function looks like a good idea, doing this would require that a major release be made as we would need to bump the current lower stdlib version bound (it's currently 4.13.1), so I think it may be best to leave as is for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get you may consider it too large, but normally I don't consider increasing the minimum version a reason for a major version bump. Though 8.1.0 is recentish for stdlib (~1 year old).

$mod_packages = {
'apreq2' => 'libapache2-mod-apreq2',
'auth_cas' => 'libapache2-mod-auth-cas',
Expand Down Expand Up @@ -379,9 +382,6 @@
'xsendfile' => 'libapache2-mod-xsendfile',
}
} else {
$php_version = $facts['os']['release']['major'] ? {
default => '7.4', # Debian Bullseye
}
$mod_packages = {
'apreq2' => 'libapache2-mod-apreq2',
'auth_cas' => 'libapache2-mod-auth-cas',
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
},
{
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/mod_php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class { 'apache::mod::php': }
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
it { is_expected.to contain 'DirectoryIndex index.php' }
end
elsif os[:family] == 'ubuntu' && os[:release] == '22.04'
describe file("#{apache_hash['mod_dir']}/php8.1.conf") do
it { is_expected.to contain 'DirectoryIndex index.php' }
end
elsif os[:family] == 'redhat' && os[:release] =~ %r{^(8)\b}
describe file("#{apache_hash['mod_dir']}/php7.conf") do
it { is_expected.to contain 'DirectoryIndex index.php' }
Expand Down
16 changes: 8 additions & 8 deletions spec/classes/mod/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
)
}

context 'with experimental php8.0' do
context 'with php8.0' do
let :params do
{ php_version: '8.0' }
ekohl marked this conversation as resolved.
Show resolved Hide resolved
end

it { is_expected.to contain_apache__mod('php') }
it { is_expected.to contain_apache__mod('php8.0') }
it { is_expected.to contain_package('libapache2-mod-php8.0') }
it {
is_expected.to contain_file('php.load').with(
content: "LoadModule php_module /usr/lib/apache2/modules/libphp.so\n",
is_expected.to contain_file('php8.0.load').with(
content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n",
)
}
end
Expand All @@ -64,16 +64,16 @@
)
}

context 'with experimental php8.0' do
context 'with php8.0' do
let :params do
{ php_version: '8.0' }
end

it { is_expected.to contain_apache__mod('php') }
it { is_expected.to contain_apache__mod('php8.0') }
it { is_expected.to contain_package('libapache2-mod-php8.0') }
it {
is_expected.to contain_file('php.load').with(
content: "LoadModule php_module /usr/lib/apache2/modules/libphp.so\n",
is_expected.to contain_file('php8.0.load').with(
content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n",
)
}
end
Expand Down