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

Permit undef passed as nil to validate_string #662

Merged
merged 1 commit into from
Oct 4, 2016

Conversation

domcleal
Copy link
Contributor

@domcleal domcleal commented Oct 4, 2016

When validate_string is called via the Puppet 4 deprecation wrappers
from deprecation_gen (introduced in 970852d), undef is passed as nil
where it was previously passed as '' from the Puppet 3-style function
API.

This change explicitly permits a nil value in validate_string, and
adds a test case to is_string which also accepts the same.

Fixes test failures in apt, concat etc:

Error while evaluating a Function Call, nil is not a string.  It looks to be a NilClass at apt/manifests/source.pp:23:3 [..]
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>'
# puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction'
# puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
# puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile'
# puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction'
# ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'

(Introduced by #659)

When validate_string is called via the Puppet 4 deprecation wrappers
from deprecation_gen (introduced in 970852d), `undef` is passed as `nil`
where it was previously passed as `''` from the Puppet 3-style function
API.

This change explicitly permits a `nil` value in validate_string, and
adds a test case to `is_string` which also accepts the same.

Fixes test failures in apt, concat etc:

    Error while evaluating a Function Call, nil is not a string.  It looks to be a NilClass at apt/manifests/source.pp:23:3 [..]
    # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>'
    # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each'
    # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>'
    # puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction'
    # puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
    # puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile'
    # puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction'
    # ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'
@DavidS
Copy link
Contributor

DavidS commented Oct 4, 2016

Thanks!

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