Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fpm config results in "expects a Hash value, got Tuple" #536

Closed
fabbks opened this issue Sep 17, 2019 · 3 comments · Fixed by #550
Closed

Fpm config results in "expects a Hash value, got Tuple" #536

fabbks opened this issue Sep 17, 2019 · 3 comments · Fixed by #550

Comments

@fabbks
Copy link

fabbks commented Sep 17, 2019

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5
  • Ruby: 2.4
  • Distribution: Debian 10 (buster)
  • Module version: 7.0.0

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

In the manifest:

  include ::php

In the hiera config:

php::fpm::pools:
  www:
    listen: '/var/run/php-fpm.sock'
    listen_owner: 'www-data'
    listen_group: 'www-data'
    pm_max_children: '100'
    pm_status_path: '/fpmstatus'

What are you seeing

Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Found value has wrong type, expects a Hash value, got Tuple (file: /etc/puppetlabs/code/environments/php
update/modules/php/manifests/fpm.pp, line: 103, column: 17)

What behaviour did you expect instead

The pool config should have been pushed to the node. Whatever I change to the hiera config, it always ends with the same error.

Output log

See above

Any additional information you'd like to impart

This behaviour is seen since the new module version is released. With the old version there are no issues.

@smoeding
Copy link

I can confirm this. Line 103 in manifests/fpm.pp looks like this:

$real_pools = lookup('php::fpm::pools', Hash, {'strategy' => 'unique'}, $pools)

The merge strategy unique is for array parameters only. But the lookup function wants a Hash. See the documentation (https://puppet.com/docs/puppet/5.2/hiera_use_function.html):

'unique' (called “array merge” in classic Hiera) — Combines any number of arrays and scalar values to return a merged, flattened array with all duplicate values removed. The lookup will fail if any hash values are found.

The lookup should return a hash since the value is used as parameter for create_resources.

I would suggest to use the deep merge strategy instead.

@olevole
Copy link
Contributor

olevole commented Sep 25, 2019

Same issue. Puppet: 6, CentOS 7

sigv added a commit to sigv/puppet-php that referenced this issue Oct 18, 2019
When allowing configuring `php::fpm::pools` as hashes in Hiera,
the `unique` ("array merge") behavior will fail for hashes. Just
use the `deep` merge behavior to return a merged hash.

Closes voxpupuli#536.
sigv added a commit to sigv/puppet-php that referenced this issue Oct 22, 2019
Puppet documentation states `unique` ("array merge") behavior
will return a merged array and will fail for hashes. We can
instead rework this lookup function to automatically lookup
the variables as per current best practises.

This change is in line with b188888.

Closes voxpupuli#536.
oxc added a commit to oxc/puppet-php that referenced this issue Nov 4, 2019
oxc added a commit to oxc/puppet-php that referenced this issue Nov 4, 2019
oxc added a commit to oxc/puppet-php that referenced this issue Nov 4, 2019
oxc added a commit to oxc/puppet-php that referenced this issue Nov 4, 2019
@cubiclelord
Copy link

We are also seeing this bug. Any chance for a quick fix/release? :)

motivator pushed a commit to bigcommerce/puppet-php that referenced this issue Oct 5, 2020
Puppet documentation states `unique` ("array merge") behavior
will return a merged array and will fail for hashes. We can
instead rework this lookup function to automatically lookup
the variables as per current best practises.

This change is in line with b188888.

Closes voxpupuli#536.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants