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
Fix fqdn_rand_string
regression
#1367
Fix fqdn_rand_string
regression
#1367
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should include these examples a few line bellow to assert that nil
and ''
as the second parameter produce the same result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the quick fix @alexjfisher
The function use to be able to accept
undef
as its second argument.eg.
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