(MODULES-8760) Add iterative feature to merge() function#1008
Merged
david22swan merged 2 commits intopuppetlabs:masterfrom Mar 26, 2019
Merged
Conversation
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).
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 ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new feature to the
merge()function such that it builds ahash from hashes returned from a lambda when the function is given an
Iterableas 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).