Skip to content

Commit

Permalink
Merge pull request #503 from miranovy/php-fpm-reload
Browse files Browse the repository at this point in the history
Fix php::fpm eternal reload for mysqli a simplexml extension
  • Loading branch information
bastelfreak authored Feb 12, 2019
2 parents d97dd6b + 86dfab0 commit 34ffabc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
6 changes: 6 additions & 0 deletions manifests/extension.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
# [*package_prefix*]
# Prefix to prepend to the package name for the package provider
#
# [*package_name*]
# Full package name for the package provider (e.g. php7.2-xml for
# simlexml extension)
#
# [*provider*]
# The provider used to install the package
# Could be "pecl", "apt", "dpkg" or any other OS package provider
Expand Down Expand Up @@ -74,6 +78,7 @@
Optional[String] $ini_prefix = undef,
Optional[String] $php_api_version = undef,
String $package_prefix = $php::package_prefix,
Optional[String[1]] $package_name = undef,
Boolean $zend = false,
Variant[Hash, Hash[String, Hash]] $settings = {},
Boolean $multifile_settings = false,
Expand All @@ -95,6 +100,7 @@
source => $source,
responsefile => $responsefile,
package_prefix => $package_prefix,
package_name => $package_name,
header_packages => $header_packages,
compiler_packages => $compiler_packages,
install_options => $install_options,
Expand Down
26 changes: 18 additions & 8 deletions manifests/extension/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
# [*package_prefix*]
# Prefix to prepend to the package name for the package provider
#
# [*package_name*]
# Full package name for the package provider (e.g. php7.2-xml for
# simlexml extension)
#
# [*provider*]
# The provider used to install the package
# Could be "pecl", "apt", "dpkg" or any other OS package provider
Expand Down Expand Up @@ -38,6 +42,7 @@
Optional[Php::Provider] $provider = undef,
Optional[String] $source = undef,
String $package_prefix = $php::package_prefix,
Optional[String[1]] $package_name = undef,
Optional[Stdlib::AbsolutePath] $responsefile = undef,
Variant[String, Array[String]] $header_packages = [],
Variant[String, Array[String]] $compiler_packages = $php::params::compiler_packages,
Expand Down Expand Up @@ -72,19 +77,24 @@
}

default: {
$real_package = "${package_prefix}${title}"
$real_package = $package_name ? {
undef => "${package_prefix}${title}",
default => $package_name,
}
$package_require = undef
}
}

unless $provider == 'none' {
package { $real_package:
ensure => $ensure,
provider => $provider,
source => $source,
responsefile => $responsefile,
install_options => $install_options,
require => $package_require,
if ! defined(Package[$real_package]) {
package { $real_package:
ensure => $ensure,
provider => $provider,
source => $source,
responsefile => $responsefile,
install_options => $install_options,
require => $package_require,
}
}
}
}
33 changes: 31 additions & 2 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@
end
context 'default parameters with extensions' do
case default[:platform]
when %r{ubuntu-18.04}, %r{ubuntu-16.04}, %r{ubuntu-14.04}
when %r{ubuntu-18.04}, %r{ubuntu-16.04}
it 'works with defaults' do
case default[:platform]
when %r{ubuntu-18.04}
simplexmlpackagename = 'php7.2-xml'
when %r{ubuntu-16.04}
simplexmlpackagename = 'php7.0-xml'
end
pp = <<-EOS
class{'php':
extensions => {
Expand All @@ -45,7 +51,30 @@
package_prefix => 'php-',
settings => {
extension => undef
}
},
},
'simplexml' => {
package_name => '#{simplexmlpackagename}',
}
}
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
when %r{ubuntu-14.04}
it 'works with defaults' do
pp = <<-EOS
class{'php':
extensions => {
'mysql' => {},
'gd' => {},
'net-url' => {
package_prefix => 'php-',
settings => {
extension => undef
},
}
}
}
Expand Down

0 comments on commit 34ffabc

Please sign in to comment.