On Friday, September 7, 2012 6:25:11 AM UTC-5, Jakov Sosic wrote:
>
> On 09/05/2012 11:37 PM, jcbollinger wrote: 
>
> > class { "mymodule": 
> >   # parameters follow... 
> >   myparam => 'custom value' 
> > } 
> > 
> > Yes, it looks very much like a resource declaration.  No, I don't think 
> > that was a good design decision, but the prevailing opinion at 
> > PuppetLabs is different, or was when parametrized classes were added. 
>
> It's a shame you cannot define multiple instances of parametrized 
> classes with different parameters :( 
>


No, that's not it.  I mean you can't do that, but the real problem is that 
you can't declare the same parametrized class multiple times even with the *
same* parameters.  That's one of the things you *can* do with ordinary 
classes (with the same effect as declaring that class exactly once), and 
there are several circumstances where it's a useful ability to have.

Classes are singletons, so it doesn't make sense to try to assign different 
sets of parameters in different places.  If you are trying to model some 
aspect of your systems that may be present more than once, then it's 
certainly a resource, and it should be modeled via one of Puppets built-in 
resources or via a resource of a custom or defined type.  Most of the time 
you can use a defined type.
 

>
> Anyway, how should I approach adding dynamic content into node's 
> manifest, using a define maybe? 
>


That's what I addressed at the end of my previous message.  I strongly 
recommend that you look into hiera.  Adding to what I already said, 
however, resources of defined types are just fine when a resource (as 
opposed to a class) is in fact what you want.  It is worthwhile to 
understand the difference between class and resource at the conceptual 
level, because there are some circumstances that require a class.  You may 
save yourself future grief if you start out with classes where they're 
appropriate, even if, for the moment, they're not actually needed.


John


-- 
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/-/ECnytUOh7MgJ.
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-users?hl=en.

Reply via email to