Issue #4780 has been updated by Nico Schottelius.
Great, that's how I assumed it should work! So an update of the master to 2.6.1 alone should fix that? ---------------------------------------- Feature #4780: Allow $var=undef in define as parameter http://projects.puppetlabs.com/issues/4780 Author: Nico Schottelius Status: Needs more information Priority: Normal Assignee: Category: Target version: Affected version: Keywords: Branch: Hello! When we encapsulate a simple type like file with a define, we would like to let the simple type take care of errors and thus pass direct input to it. This does not work however: Current code: define nginx::site($ensure=present, $source=false, $content=false) { include nginx $config_file="/etc/nginx/sites-enabled/$name" file { $config_file: owner => "root", group => "root", mode => 0644, ensure => $ensure, source => $source ? { false => undef, default => $source, }, content => $content ? { false => undef, default => $content, }, notify => Service['nginx'], } } Expected code: define site($ensure=present, $source=undef, $content=undef) { include nginx $config_file="/etc/nginx/sites-enabled/$name" file { $config_file: owner => "root", group => "root", mode => 0644, ensure => $ensure, source => $source, content => $content, notify => Service['nginx'], } } If you allow specifying arguments for defined types, an optimised version would look even smaller: define site(__args_used=[file]) { include nginx $config_file="/etc/nginx/sites-enabled/$name" file { $config_file: owner => "root", group => "root", mode => 0644, notify => Service['nginx'], } } Whether the second or the third version or a complete different syntax would fit best is one question. Clear is that the first version is code redundancy and it should be possible to avoid it. -- 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.
