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

Would the recommended method for creating a resource and passing nothing for 
some of the values be to use create_resources() and a config hash like in 
[puppetlabs-mysql/manifests/server.pp](https://github.com/puppetlabs/puppetlabs-mysql/blob/master/manifests/server.pp)
 lines 28-30?

That wouldn't work in the debbuilder example mentioned above though if you only 
pass a value for cow_root and want to keep the default value for cows.
The only decent way to accomplish that without code duplication would be to 
have both classes inheriting from the same params class and getting the default 
value from there. However, the current style guideline recommends against doing 
that (because it requires Puppet 2.6.3+).

So if you decide to change the behavior here I think you should change the 
style guideline as well.
----------------------------------------
Bug #16221: Passing undef as argument to classes & defines overrides default 
parameter
https://projects.puppetlabs.com/issues/16221#change-70949

Author: Erik Dalén
Status: Closed
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