Issue #13210 has been updated by Raphaƫl Pinson.
I know this bug is marked as closed, but I think there is a way to fix this without redefining 'undef' in Puppet See the code in https://github.com/raphink/puppet/compare/dev;function_honor_undef, which essentially does this: * Define a new :honor_undef parameter when creating functions, which prevents :undef from being munged when passed as an argument to a function. This way, function authors can choose to manage :undef themselves instead of having it default to ''; * Use :honor_undef => true in the hiera() function, so 'undef' can be passed in Puppet as a default value. Would that be an acceptable way to fixing this issue? ---------------------------------------- Bug #13210: undef changes into '' when passed to function as a param https://projects.puppetlabs.com/issues/13210#change-91625 * Author: Timur Batyrshin * Status: Duplicate * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: * Keywords: * Branch: ---------------------------------------- Suppose we have a manifest like that: <pre> define foo ( $x = '1' ) { notify { "x${x}": } } class bar { $x = myfunc( undef ) foo {'no1': x=> $x } } class baz { $x = undef foo {'no2': x=> $x } } include bar include baz </pre> With myfunc() defined like that: <pre> module Puppet::Parser::Functions newfunction(:myfunc, :type => :rvalue) do |param| return param end end </pre> When applying the manifest we get the following output. <pre> notice: x notice: /Stage[main]/Bar/Foo[no1]/Notify[x]/message: defined 'message' as 'x' notice: x1 notice: /Stage[main]/Baz/Foo[no2]/Notify[x1]/message: defined 'message' as 'x1' notice: Finished catalog run in 0.06 seconds </pre> However the same message should be produced in both calls to foo. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
