Skip to content

(MODULES-8760) Add iterative feature to merge() function #1008

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

Conversation

hlindberg
Copy link
Contributor

This adds a new feature to the merge() function such that it builds a
hash from hashes returned from a lambda when the function is given an
Iterable as its only argument.

This adds a 4.x version of merge that is backwards compatible (except it
generates different error messages for argument errors). Since a 4.x
version wins over a 3x the new version will win over the old except for
users that use the old API for calling functions (as expected; this is
fine).

This adds a new feature to the `merge()` function such that it builds a
hash from hashes returned from a lambda when the function is given an
`Iterable` as its only argument.

This adds a 4.x version of merge that is backwards compatible (except it
generates different error messages for argument errors). Since a 4.x
version wins over a 3x the new version will win over the old except for
users that use the old API for calling functions (as expected; this is
fine).
@david22swan david22swan merged commit 9848130 into puppetlabs:master Mar 26, 2019
alexjfisher added a commit to voxpupuli/puppet-jenkins that referenced this pull request Apr 15, 2019
Latest stdlib (from git) has a new `merge` implementation.
puppetlabs/puppetlabs-stdlib#1008

It appears to be broken for puppet 4.  We're planning to drop puppet 4
any moment, but for right now, replacing the call to `merge` with `+`
works fine.

Fixes

```
Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Function Call, 'merge' expects one of:
         (Variant[Hash, Undef, String[0, 0]] args*)
           rejected: parameter 'args' variant 0 entry 'notify' expects a value of type Undef or Data, got Type[Class]
           rejected: parameter 'args' variant 1 expects a value of type Undef or String, got Struct
         (Iterable args*, Callable[3, 3] block)
           rejected: expects a block
         (Iterable args*, Callable[2, 2] block)
           rejected: expects a block at /home/travis/build/voxpupuli/puppet-jenkins/spec/fixtures/modules/jenkins/manifests/config.pp:45:16
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants