13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.1.0](https://github.com/voxpupuli/puppet-php/tree/v8.1.0) (2022-07-03)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.3...v8.1.0)

**Implemented enhancements:**

- Allow unsupported environments [\#662](https://github.com/voxpupuli/puppet-php/pull/662) ([jkroepke](https://github.com/jkroepke))

**Fixed bugs:**

- php-fpm: Reload service with systemd if available [\#664](https://github.com/voxpupuli/puppet-php/pull/664) ([bastelfreak](https://github.com/bastelfreak))
- Arch Linux: Fix package names and set correct php-fpm user \(root -\> http\) [\#663](https://github.com/voxpupuli/puppet-php/pull/663) ([jkroepke](https://github.com/jkroepke))

## [v8.0.3](https://github.com/voxpupuli/puppet-php/tree/v8.0.3) (2022-03-21)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.2...v8.0.3)
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ Data type: `Boolean`



Default value: ``true``
Default value: `$php::params::pear`

##### <a name="pear_ensure"></a>`pear_ensure`

Expand Down
8 changes: 4 additions & 4 deletions manifests/dev.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
) inherits php::params {
assert_private()

# On FreeBSD there is no 'devel' package.
$real_package = $facts['os']['family'] ? {
'FreeBSD' => [],
default => $package,
# On FreeBSD, Arch there is no 'devel' package. If dev_package_suffix is undef, consider to not install.
$real_package = $php::params::dev_package_suffix ? {
undef => [],
default => $package,
}

if $facts['os']['family'] == 'Debian' {
Expand Down
5 changes: 4 additions & 1 deletion manifests/fpm/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
}

if $reload_fpm_on_config_changes {
$restart = "service ${service_name} reload"
$restart = $facts['service_provider'] ? {
'systemd' => "systemctl reload ${service_name}",
undef => "service ${service_name} reload"
}
} else {
$restart = undef
}
Expand Down
30 changes: 16 additions & 14 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
Optional[Stdlib::Absolutepath] $fpm_pid_file = undef,
Optional[Enum['rhscl', 'remi']] $rhscl_mode = undef,
) {
$default_php_version = $facts['os']['name'] ? {
'Debian' => $facts['os']['release']['major'] ? {
'10' => '7.3',
'11' => '7.4',
default => fail("Unsupported Debian release: ${fact('os.release.major')}"),
},
'Ubuntu' => $facts['os']['release']['major'] ? {
'18.04' => '7.2',
'20.04' => '7.4',
default => fail("Unsupported Ubuntu release: ${fact('os.release.major')}"),
},
default => '5.x',
if ($php_version == undef) {
$globals_php_version = $facts['os']['name'] ? {
'Debian' => $facts['os']['release']['major'] ? {
'10' => '7.3',
'11' => '7.4',
default => fail("Unsupported Debian release: ${fact('os.release.major')}"),
},
'Ubuntu' => $facts['os']['release']['major'] ? {
'18.04' => '7.2',
'20.04' => '7.4',
default => fail("Unsupported Ubuntu release: ${fact('os.release.major')}"),
},
default => '5.x',
}
} else {
$globals_php_version = $php_version
}

$globals_php_version = pick($php_version, $default_php_version)

case $facts['os']['family'] {
'Debian': {
if $facts['os']['name'] == 'Ubuntu' {
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
Boolean $embedded = false,
Boolean $dev = true,
Boolean $composer = true,
Boolean $pear = true,
Boolean $pear = $php::params::pear,
String $pear_ensure = $php::params::pear_ensure,
Boolean $phpunit = false,
Boolean $apache_config = false,
Expand Down
10 changes: 8 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
$ext_tool_enable = $php::globals::ext_tool_enable
$ext_tool_query = $php::globals::ext_tool_query
$ext_tool_enabled = true
$pear = true

case $facts['os']['name'] {
'Debian': {
Expand Down Expand Up @@ -103,6 +104,8 @@
$ext_tool_enable = undef
$ext_tool_query = undef
$ext_tool_enabled = false
$pear = true

case $facts['os']['name'] {
'SLES': {
$compiler_packages = []
Expand Down Expand Up @@ -170,6 +173,7 @@
$ext_tool_enable = undef
$ext_tool_query = undef
$ext_tool_enabled = false
$pear = true
}
'FreeBSD': {
$config_root = $php::globals::globals_config_root
Expand Down Expand Up @@ -200,6 +204,7 @@
$ext_tool_enable = undef
$ext_tool_query = undef
$ext_tool_enabled = false
$pear = true
}
'Archlinux': {
$config_root_ini = '/etc/php/conf.d'
Expand All @@ -215,8 +220,8 @@
$fpm_package_suffix = 'fpm'
$fpm_pool_dir = '/etc/php/php-fpm.d'
$fpm_service_name = 'php-fpm'
$fpm_user = 'root'
$fpm_group = 'root'
$fpm_user = 'http'
$fpm_group = 'http'
$apache_inifile = '/etc/php/php.ini'
$embedded_package_suffix = 'embedded'
$embedded_inifile = '/etc/php/php.ini'
Expand All @@ -227,6 +232,7 @@
$ext_tool_enable = undef
$ext_tool_query = undef
$ext_tool_enabled = false
$pear = false
}
default: {
fail("Unsupported osfamily: ${facts['os']['family']}")
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-php",
"version": "8.0.3",
"version": "8.1.0",
"author": "Vox Pupuli",
"summary": "Generic PHP module that supports many platforms",
"license": "MIT",
Expand Down
48 changes: 24 additions & 24 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
apply_manifest(pp, catch_changes: true)
end

case default[:platform]
when %r{ubuntu-20.04}, %r{debian-11}
packagename = 'php7.4-fpm'
when %r{ubuntu-18.04}
packagename = 'php7.2-fpm'
when %r{el}
packagename = 'php-fpm'
when %r{debian-10}
packagename = 'php7.3-fpm'
end
packagename = case default[:platform]
when %r{ubuntu-20.04}, %r{debian-11}
'php7.4-fpm'
when %r{ubuntu-18.04}
'php7.2-fpm'
when %r{debian-10}
'php7.3-fpm'
else
'php-fpm'
end
describe package(packagename) do
it { is_expected.to be_installed }
end
Expand All @@ -42,9 +42,9 @@
simplexmlpackagename = 'php7.2-xml'
end
pp = <<-EOS
class{'php':
class{ 'php':
extensions => {
'mysql' => {},
'intl' => {},
'gd' => {},
'net-url' => {
package_prefix => 'php-',
Expand All @@ -62,9 +62,9 @@
else
it 'works with defaults' do
pp = <<-EOS
class{'php':
class{ 'php':
extensions => {
'mysql' => {},
'intl' => {},
'gd' => {}
}
}
Expand All @@ -75,16 +75,16 @@
end
end

case default[:platform]
when %r{ubuntu-20.04}, %r{debian-11}
packagename = 'php7.4-fpm'
when %r{ubuntu-18.04}
packagename = 'php7.2-fpm'
when %r{el}
packagename = 'php-fpm'
when %r{debian-10}
packagename = 'php7.3-fpm'
end
packagename = case default[:platform]
when %r{ubuntu-20.04}, %r{debian-11}
'php7.4-fpm'
when %r{ubuntu-18.04}
'php7.2-fpm'
when %r{debian-10}
'php7.3-fpm'
else
'php-fpm'
end
describe package(packagename) do
it { is_expected.to be_installed }
end
Expand Down
5 changes: 3 additions & 2 deletions spec/classes/php_fpm_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
it { is_expected.to contain_class('php::packages') }
it { is_expected.to contain_class('php::globals') }
it { is_expected.to contain_class('php::params') }
it { is_expected.to contain_class('php::pear') }

it { is_expected.to contain_class('php::pear') } if facts[:osfamily] != 'Archlinux'
end

describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup
describe 'when called with no parameters' do
case facts[:osfamily]
when 'Debian'
case facts[:operatingsystemrelease]
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/php_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end
end

describe 'when configuring a package repo' do # rubocop: disable RSpec/EmptyExampleGroup
describe 'when configuring a package repo' do
case facts[:osfamily]
when 'Debian'
case facts[:operatingsystem]
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
it { is_expected.to compile.with_all_deps }
end

describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup
describe 'when called with no parameters' do
case facts[:osfamily]
when 'Suse', 'RedHat', 'CentOS'
it { is_expected.to contain_class('php::global') }
Expand Down Expand Up @@ -127,7 +127,7 @@
end
end

describe 'when called with package_prefix parameter' do # rubocop: disable RSpec/EmptyExampleGroup
describe 'when called with package_prefix parameter' do
package_prefix = 'myphp-'
let(:params) { { package_prefix: package_prefix } }

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'php::config' do
on_supported_os.each do |os, facts|
context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup
context "on #{os}" do
let :facts do
facts
end
Expand Down
92 changes: 49 additions & 43 deletions spec/defines/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,58 +138,64 @@
it { is_expected.to contain_php__config('xdebug').with_config('zend_extension' => 'xdebug.so') }
end

context 'pecl extensions support so_name' do
let(:title) { 'zendopcache' }
let(:params) do
{
provider: 'pecl',
zend: true,
so_name: 'opcache'
}
end

it do
is_expected.to contain_php__config('zendopcache').with(
file: "#{etcdir}/opcache.ini",
config: {
'zend_extension' => 'opcache.so'
if facts[:os]['family'] != 'Archlinux'
context 'pecl extensions support so_name' do
let(:title) { 'zendopcache' }
let(:params) do
{
provider: 'pecl',
zend: true,
so_name: 'opcache'
}
)
end
end
end

context 'add ini file prefix if requested' do
let(:title) { 'zendopcache' }
let(:params) do
{
provider: 'pecl',
zend: true,
ini_prefix: '10-',
so_name: 'opcache'
}
it do
is_expected.to contain_php__config('zendopcache').with(
file: "#{etcdir}/opcache.ini",
config: {
'zend_extension' => 'opcache.so'
}
)
end
end
end

it do
is_expected.to contain_php__config('zendopcache').with(
file: "#{etcdir}/10-opcache.ini",
config: {
'zend_extension' => 'opcache.so'
if facts[:os]['family'] != 'Archlinux'
context 'add ini file prefix if requested' do
let(:title) { 'zendopcache' }
let(:params) do
{
provider: 'pecl',
zend: true,
ini_prefix: '10-',
so_name: 'opcache'
}
)
end

it do
is_expected.to contain_php__config('zendopcache').with(
file: "#{etcdir}/10-opcache.ini",
config: {
'zend_extension' => 'opcache.so'
}
)
end
end
end

context 'pecl extensions support php_api_version' do
let(:title) { 'xdebug' }
let(:params) do
{
provider: 'pecl',
zend: true,
php_api_version: '20100525'
}
end
if facts[:os]['family'] != 'Archlinux'
context 'pecl extensions support php_api_version' do
let(:title) { 'xdebug' }
let(:params) do
{
provider: 'pecl',
zend: true,
php_api_version: '20100525'
}
end

it { is_expected.to contain_php__config('xdebug').with_config('zend_extension' => '/usr/lib/php5/20100525/xdebug.so') }
it { is_expected.to contain_php__config('xdebug').with_config('zend_extension' => '/usr/lib/php5/20100525/xdebug.so') }
end
end

if facts[:os]['family'] == 'Debian'
Expand Down
Loading