On Tuesday, June 26, 2012 6:13:21 AM UTC-7, jcbollinger wrote:

> I sympathize and agree in principle with the view that it should be 
> possible to re-declare the same parameterized class provided the parameters 
> are all the same.  Nevertheless, that has never been possible with Puppet 
> 2.x's parameterized class declaration syntax.  At the time that syntax and 
> its rules were designed, the prevailing view at Puppetlabs was apparently 
> that the resulting constraints were acceptable.  It's one of the reasons I 
> find parameterized classes *un*acceptable, but I can't call it a bug per 
> se.
>
> I have been told that this will be better in Puppet 3, but I have not 
> checked whether that's so. 
>
>
It's better! It turns out the solution to class parameter conflicts is to 
get the parameter values from somewhere outside the manifests. That way, 
the decisions about what the values should be are already finished by the 
time the catalog is being compiled, and you can just use "include" on 
parameterized classes as many times as you want.

Our implementation is to get class parameters from Hiera. If a class has 
parameters, using include on it it will automatically trigger a standard 
Hiera lookup of those parameters. It'll be roughly equivalent to doing:

class {'myclass':
  param1 => hiera('myclass::param1'),
  param2 => hiera('myclass::param2'),
}

You can still use the class {'my_class':} style if you want to (with all 
the same limitations as today), but since "include" will work now and Hiera 
isn't very complicated, we figure most people can forget about it. 

Anyway, as you can see, that changes the mental model a bit -- the hiera 
yaml files become sort of a cascading configuration file for all of your 
Puppet classes, and class parameters are like settings. 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/jWiIO6onwhkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to