Issue #16221 has been updated by Erik Dalén.

The use case for this has been when having nested parameterized classes where 
one does a bit more and then just passes the other parameters on to the other 
class. For example having a postgresql::server class that takes a bunch of 
parameters and then having a postgresql::server_with_backup class that sets up 
some backup stuff but passes most of the parameters on to the 
postgresql::server class. And of course I wouldn't want to set the defaults for 
all those parameters in both classes, so they are set to undef in the backup 
class.

Sure this can be refactored and solved in other ways like having a settings 
hash and passing that on. Or setting parameter defaults using hiera in puppet 3.
But if you are really changing this behavior it  should be clearly documented 
and preferably output deprecation warnings in a 2.7.x release just like the 
dynamic scoping.
----------------------------------------
Bug #16221: Passing undef as argument to classes & defines overrides default 
parameter
https://projects.puppetlabs.com/issues/16221#change-70479

Author: Erik Dalén
Status: Investigating
Priority: Normal
Assignee: eric sorenson
Category: 
Target version: 3.0.0
Affected Puppet version: 3.0.0-rc5
Keywords: parameter undef
Branch: 


In puppet 3.0.0-rc5 the default value is overridden if I pass undef as a 
parameter to a define or class.

Example:

    define bar ($param='Hello world') {
      notice($param)
    }
    define foo ($param=undef) {
      bar { 'bartest': param => $param }
    }
    foo { 'footest': }

In puppet 2.7.19 that outputs:
    notice: Scope(Bar[bartest]): Hello world
    
But in puppet 3.0.0-rc5 I get:
    Scope(Bar[test]): 


-- 
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