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

seeded_rand_string() function #877

Merged
merged 3 commits into from
Jul 17, 2018

Conversation

pegasd
Copy link
Contributor

@pegasd pegasd commented Feb 20, 2018

This function is useful for generating consistent random strings (read "passwords") across different nodes.

# @return [String] Random string.
dispatch :rand_string do
param 'Integer[1]', :length
param 'String', :seed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text description states that seed is optional, but this declaration is for a required param.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed and fixed.

@hlindberg
Copy link
Contributor

I think it is worth opening a ticket in puppet's Jira in the MODULES project to discuss the merit of this function. There are already other functions related to 'random' and there may be opportunity to do something about sprawling additions of "random this" and "random that"...

@eputnam
Copy link
Contributor

eputnam commented Mar 8, 2018

@hlindberg we already have an fqdn_rand() and fqdn_rand_string() but only seeded_rand() with no seeded_rand_string(). This method doesn't seem like sprawl with that in mind.

@hlindberg
Copy link
Contributor

fqdn_rand_string can be given a seed - how is this different? Why are so many different functions needed for almost the same functionality? Why not a simpler API and more intuitive names? Say random_number and random_string and then use named options to make those produce the different variations of using fqdn as seed or some other seed, length of string, an Integer or a Float etc. Come to think of it, even just random would work and then give it a data type that expresses a range - for example random(Integer[1,100]), random(String[10]).

@pegasd
Copy link
Contributor Author

pegasd commented Mar 22, 2018

@hlindberg There is currently no way to generate the same randomized string on two different hosts.
I do agree with your naming approach though. Let's pick whichever one is more suitable for this.

@david22swan
Copy link
Member

@pegasd Is there any movement on this PR?

@pegasd
Copy link
Contributor Author

pegasd commented Jul 16, 2018

@david22swan How should I proceed here? I'm open to suggestions. Or, if the community finds this insecure, I'm OK with closing this for good.

@david22swan david22swan merged commit a01dc94 into puppetlabs:master Jul 17, 2018
@hlindberg
Copy link
Contributor

Hm, I had objections to this, those concerns were not addressed. We could do much better than what was now merged. Suggest reverting this.

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

Successfully merging this pull request may close these issues.

4 participants