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

Open
#649 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
devops

Research direction

Start with the fpm::pool data type validation added in issue #634 and reproduce the reported Puppet resource using environment-variable placeholders for the PM settings. Done means integer values and supported environment-variable references pass validation, the configuration is written to the PHP-FPM file, and Puppet reports no errors.

Written by the indexing model from the issue text.

Description

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
Dominant language
Puppet
Stars
86
Forks
264
Avg merge
29m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from voxpupuli/puppet-php

All issues in voxpupuli/puppet-php

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.