puppet-php icon indicating copy to clipboard operation
puppet-php copied to clipboard

Data type validation in fpm::pool breaks ability to use environment variables as values

Open chrisboulton opened this issue 4 years ago • 0 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: Any
  • Ruby: Any
  • Distribution: Any
  • Module version: 8.0+

How to reproduce (e.g Puppet code you use)

php::fpm::pool { 'www':
  ..
  pm_max_children => '${FPM_MAX_CHILDREN}',
}

What are you seeing

The validation added in #634 appears to have broken the ability to configure the PM settings via environment variables (interpreted at runtime), which is something we do to allow our environment to determine the PHP runtime settings.

Per the PHP docs, this is a supported configuration: https://www.php.net/manual/en/configuration.file.php#example-1

Suggestion would be to make these either Variant[String, Integer[..]] or for a more strict approach something like, Variant[Pattern[/\$\{[\w]+\}/], Integer[..]].

What behaviour did you expect instead

No Puppet errors, environment variable based configuration written out to file.

Output log

Error: Evaluation Error: Error while evaluating a Resource Statement, Php::Fpm::Pool[www]:
  parameter 'pm_max_children' expects an Integer value, got String
  parameter 'pm_start_servers' expects an Integer value, got String
  parameter 'pm_min_spare_servers' expects an Integer value, got String
  parameter 'pm_max_spare_servers' expects an Integer value, got String
  parameter 'pm_max_requests' expects an Integer value, got String

chrisboulton avatar Dec 28 '21 03:12 chrisboulton