On 2013-16-09 8:57, Erik Dalén wrote:
Would this mean that this code would change from printing 'hello' to
printing ''?

class foo ($x='hello') { notify { $x: }}
class { 'foo': x => undef }

Yes.

And I guess the former behaviour would be achieved by changing it to:
class foo ($x='hello') { notify { $x: }}
class { 'foo': x => default }

Yes.


I think such a change makes sense, but on the other hand it might make
it tricky to create modules that work in both versions. So you get into
the situation where you have to change your puppet code at the same time
as you upgrade instead of being able to prepare it for the next major
version ahead of the upgrade.

It could be done with a function 'undef_as_default'. Using your example:

  class foo ($x='hello') { notify { $x: }}
  class { 'foo': x => undef_as_default(undef) }

prints 'hello'.

This function basically produces literal default for undef, and the given value otherwise. This because literal default does not parse with older parsers.

If the function is used in a runtime where undef still means default, it simply returns undef. I imagine a 3.x release where it returns literal default, and that it in older 3.x versions (where we have backported the function) returns literal undef.

- henrik


--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" 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-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to