Issue #13210 has been updated by Chris Price.

I agree about the general strategy of never exposing :undef outside of our 
walls... so, for this specific ticket, what we are talking about is changing 
the current behavior where we translate undefs to '' before passing them to 
functions; we'd pass nil instead.  As far as I can tell, everyone seems in 
relative agreement on that point.

Do we need to introduce a transition period with a deprecation warning?  It 
would certainly be the safest path forward if we are concerned about this 
change breaking a lot of things, but it would postpone the ability for users 
such as the author of this ticket to actually handle this type of use case.  
So, the sooner we are able to introduce the change, the better.

Thoughts?  Daniel / R.I. do you gentlemen have any ideas as to exactly how 
large of an impact this change would have on the community?
----------------------------------------
Bug #13210: undef changes into '' when passed to function as a param
https://projects.puppetlabs.com/issues/13210#change-59005

Author: Timur Batyrshin
Status: Needs Decision
Priority: Normal
Assignee: Chris Price
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to