So, I dopped into the debugger with: $x = inline_template("<%= require 'ruby-debug';debugger;puts 'foo' %>"
and realized that the value returned from the statement: $var1_override = $override_hash['var1'] is actually nil. So an easier version of my question is rather or not nil can be treated the same as undefined in Puppet. On Tue, May 1, 2012 at 9:06 PM, Dan Bode <d...@puppetlabs.com> wrote: > Hi all, > > I have run into an example where Puppet behaves exactly like I hoped it > would. I am a little concerned that it may just be a coincidence that it > happens to work like this. My question is rather or not the following is > specified behavior that I can take advantage of (I may take advantage of it > anyways, the question is actually rather I should be concerned about it > working in the future :) ) > > My use case: > > Supposed I have a class that has parameters that have defaults specified: > > class one( > $var1 = 'default1', > $var2 = 'default2' > ) { > > notify { $var1: } > notify { $var2: } > } > > I want to call this class from another class, and that has a class > parameter that accepts a hash that is used to potentially override various > parameters from class 'one' > > class two( > $override_hash = {} > ) { > > $var1_override = $override_hash['var1'] > > class { 'one': > var1 => $var1_override > } > } > > class { 'two': } > > I was hoping that var1 from class one would not be overridden if the key > var1 did not exist in the hash (I was hoping that it would be equivalent to > passing undef) > > > And that is actually exactly how it worked. > > Is that on purpose? I did not find anything about this in the > documentation. > > regards, > > Dan > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.