Skip to content

Commit

Permalink
Merge pull request #687 from jcharaoui/master
Browse files Browse the repository at this point in the history
Add support for Debian 12 (bookworm)
  • Loading branch information
kenyon committed Dec 5, 2023
2 parents f5b4f25 + 13c508b commit ebb71fc
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
4 changes: 4 additions & 0 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'Debian' => $facts['os']['release']['major'] ? {
'10' => '7.3',
'11' => '7.4',
'12' => '8.2',
default => fail("Unsupported Debian release: ${fact('os.release.major')}"),
},
'Ubuntu' => $facts['os']['release']['major'] ? {
Expand Down Expand Up @@ -84,6 +85,9 @@
}
}
} else {
if $flavor == 'zend' and versioncmp($facts['os']['release']['major'], '11') > 0 {
fail("Zend PHP is unsupported on this Debian release: ${fact('os.release.major')}")
}
case $globals_php_version {
/^5\.6/,
/^7\.[0-9]/,
Expand Down
4 changes: 2 additions & 2 deletions manifests/repo/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
include 'apt'

if ($dotdeb and $facts['os']['release']['major'] in ['6', '7', '8']) {
if ($dotdeb and versioncmp($facts['os']['release']['major'], '9') < 1) {
apt::source { 'source_php_dotdeb':
location => $location,
repos => $repos,
Expand All @@ -50,7 +50,7 @@
}
}

if ($sury and $facts['os']['release']['major'] in ['9', '10', '11']) {
if ($sury and versioncmp($facts['os']['release']['major'], '9') >= 0) {
apt::source { 'source_php_sury':
location => 'https://packages.sury.org/php/',
repos => 'main',
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"10",
"11"
"11",
"12"
]
},
{
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
'php7.2-fpm'
when %r{debian-10}
'php7.3-fpm'
when %r{debian-12}
'php8.2-fpm'
else
'php-fpm'
end
Expand Down Expand Up @@ -88,6 +90,8 @@
'php7.2-fpm'
when %r{debian-10}
'php7.3-fpm'
when %r{debian-12}
'php8.2-fpm'
else
'php-fpm'
end
Expand Down
5 changes: 2 additions & 3 deletions spec/classes/php_repo_debian_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
if facts[:os]['name'] == 'Debian'
it { is_expected.to compile.with_all_deps }

case facts[:os]['release']['major']
when '6', '7', '8'
if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_apt__source('source_php_dotdeb') }
it { is_expected.not_to contain_apt__source('source_php_sury') }
when '9', '10', '11'
elsif facts[:os]['release']['major'].to_i >= 9
it { is_expected.not_to contain_apt__source('source_php_dotdeb') }
it { is_expected.to contain_apt__source('source_php_sury') }
end
Expand Down
14 changes: 13 additions & 1 deletion spec/classes/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
php_cli_package = case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'php8.2-cli'
when '11'
'php7.4-cli'
when '10'
Expand All @@ -34,6 +36,8 @@
php_fpm_package = case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'php8.2-fpm'
when '11'
'php7.4-fpm'
when '10'
Expand All @@ -56,6 +60,8 @@
php_dev_package = case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'php8.2-dev'
when '11'
'php7.4-dev'
when '10'
Expand Down Expand Up @@ -178,6 +184,8 @@
case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'/etc/php/8.2/fpm/pool.d/www.conf'
when '11'
'/etc/php/7.4/fpm/pool.d/www.conf'
when '10'
Expand Down Expand Up @@ -221,6 +229,8 @@
case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'/etc/php/8.2/fpm/pool.d/www.conf'
when '11'
'/etc/php/7.4/fpm/pool.d/www.conf'
when '10'
Expand Down Expand Up @@ -271,6 +281,8 @@
case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'/etc/php/8.2/fpm/pool.d/www.conf'
when '11'
'/etc/php/7.4/fpm/pool.d/www.conf'
when '10'
Expand Down Expand Up @@ -315,7 +327,7 @@
it { is_expected.not_to contain_class('php::composer') }
end

if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS' || facts[:osfamily] == 'Debian'
if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS' || facts[:os]['name'] == 'Ubuntu' || (facts[:os]['name'] == 'Debian' && facts[:os]['release']['major'].to_i < 12)
describe 'when called with flavor zend' do
zendphp_cli_package = case facts[:os]['name']
when 'Debian', 'Ubuntu'
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
etcdir = case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '12'
'/etc/php/8.2/mods-available'
when '11'
'/etc/php/7.4/mods-available'
when '10'
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/fpm_pool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
let(:params) { {} }

case facts[:os]['release']['major']
when '12'
it { is_expected.to contain_file('/etc/php/8.2/fpm/pool.d/unique-name.conf') }
when '11'
it { is_expected.to contain_file('/etc/php/7.4/fpm/pool.d/unique-name.conf') }
when '10'
Expand Down

0 comments on commit ebb71fc

Please sign in to comment.