Fix fqdn_rand_string regression#1367
Merged
jordanbreen28 merged 1 commit intopuppetlabs:mainfrom Jun 12, 2023
Merged
Conversation
smortex
previously approved these changes
Jun 8, 2023
Comment on lines
+21
to
+23
| it { is_expected.to run.with_params(100, nil).and_return(default_charset) } | ||
| it { is_expected.to run.with_params(100, nil, 'MY_CUSTOM_SEED').and_return(default_charset) } |
Collaborator
There was a problem hiding this comment.
Maybe we should include these examples a few line bellow to assert that nil and '' as the second parameter produce the same result?
Collaborator
Author
There was a problem hiding this comment.
ok, can do. Interestingly, undef and empty string use to produce the same result because of this.
(Of Puppet 3 functions)
When functions are called, undef is cast into an empty string. Passing undef to a function is most likely not what you mean to do.
That might explain the history of the way the function was originally coded.
The function use to be able to accept `undef` as its second argument. eg. ```puppet fqdn_rand_string(10, undef, 'custom seed') ``` Using `undef` to mean 'use the default' is much more conventional than `''` (empty string). This commit restores the old interface broken in `9.0.0`
cd5925a to
d6847c0
Compare
jordanbreen28
approved these changes
Jun 12, 2023
Contributor
jordanbreen28
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the quick fix @alexjfisher
deric
added a commit
to deric/puppet-pgprobackup
that referenced
this pull request
Jun 21, 2024
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.
The function use to be able to accept
undefas its second argument.eg.
Using
undefto mean 'use the default' is much more conventional than''(empty string).This commit restores the old interface broken in
9.0.0