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

(#12776) Added validate_slength function and rspec test #37

Merged
merged 1 commit into from
Feb 22, 2012
Merged

(#12776) Added validate_slength function and rspec test #37

merged 1 commit into from
Feb 22, 2012

Conversation

fiddyspence
Copy link
Contributor

This function is used to validate a string is less than a maximum length. The
string, or array of strings, is passed as the first argument to the function.
The maximum length of the string is passed as the second argument.

It is useful to validate, for example, that Puppet is not sending a username
to a downstream system that the system cannot cope with, but that might not
cause an error message - for example, MySQL will not accept a username of
more than 16 characters. This enables a Puppet administrator to validate
the data that it may have been passed from upstream through, for example,
Hiera.

@ghost ghost assigned kbarber Feb 22, 2012
@kbarber
Copy link
Contributor

kbarber commented Feb 22, 2012

Looking now.

@kbarber
Copy link
Contributor

kbarber commented Feb 22, 2012

Check for whitespace issues on the file, see the .gitconfig I sent you, as it will show up whitespace errors with 'git diff'.

module Puppet::Parser::Functions

newfunction(:validate_slength, :doc => <<-'ENDHEREDOC') do |args|
Validate that argument 1 is a string (or an array of strings, and
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps calling it arg 1 might confuse people, as a lot of people would expect zero based indexing. Just call it 'first argument/second argument' or something.

Also, your missing a ).

This function is used to validate a string is less than a maximum length.  The
string, or array of strings, is passed as the first argument to the function.
The maximum length of the string is passed as the second argument.

It is useful to validate, for example, that Puppet is not sending a username
to a downstream system that the system cannot cope with, but that might not
cause an error message - for example, MySQL will not accept a username of
more than 16 characters.  This enables a Puppet administrator to validate
the data that it may have been passed from upstream through, for example,
Hiera.
kbarber added a commit that referenced this pull request Feb 22, 2012
…slength

(#12776) Added validate_slength function and rspec test
@kbarber kbarber merged commit c0ac470 into puppetlabs:master Feb 22, 2012
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.

3 participants