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.

Reply via email to