The recent refactor of the the fpm classes breaks the ability to have specific FPM php.ini settings when using Hiera
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 3.8.x
- Ruby: 1.9.3
- Distribution: Ubuntu
- Module version: 4.0.0
How to reproduce (e.g Puppet code you use)
The recent refactor of how php::fpm works in https://github.com/voxpupuli/puppet-php/commit/4a57db7a90590ab853a9bcab3ae2a118a9c18865 breaks the ability to have specific php.ini settings for the FPM sapi when using Hiera data.
The specific issue is that the php::fpm class is now called using contain on line 198 in manifests/init.pp:
if $fpm { contain '::php::fpm' }
The diff starts here: https://github.com/voxpupuli/puppet-php/commit/4a57db7a90590ab853a9bcab3ae2a118a9c18865#diff-60ae41fd0a31977447947f59940ee9a4L170
This change ignores the $real_settings variable that contains the actual settings for php::fpm. Instead of passing those settings to the php::fpm class, the caller is expecting the the php::fpm class to be able to access an outer scope variable, ::php::settings.
If you need your FPM php.ini settings to legitimately be separate from the CLI php.ini config, like more restricted memory limits, etc., the only way to do that, as this module is defined, is to create a Hiera variable named php::fpm::settings. But, because of the change in 4a57db7a90590ab853a9bcab3ae2a118a9c18865, the reference to ::php::settings is overwritten by the deep merge on line 71 in manifests/fpm.pp, effectively throwing away any global php.ini settings defined when your class { 'php': } was called.
See: https://github.com/voxpupuli/puppet-php/blob/4a57db7a90590ab853a9bcab3ae2a118a9c18865/manifests/fpm.pp#L71
The only work around for this is to full duplicate your cli and fpm PHP settings in hiera, even if only a single setting is different. I guess the other would be to have a single monolithic PHP configuration that applies to all SAPIs, but that means the lowest common denominator sapi controls all others. e.g. Memory limits on php-fpm cause basic CLI tools to blow up because they don't have enough memory to run.