Thank you both for your great replies. They've both given me a great
lead on which direction to head in. I haven't had the time to fully
flesh out how I'm going to handle this yet but I know I'll be trying
to stay away from parametrized classes for the time being. I'll also
be trying to use hiera as much as possible to handle external data and
determining which classes get applied to which nodes.

Thanks again for the help.

Romeo

On Mon, Mar 5, 2012 at 04:24, jcbollinger <john.bollin...@stjude.org> wrote:
>
>
> On Mar 2, 2:12 pm, Romeo Theriault <romeo.theria...@maine.edu> wrote:
>> On Fri, Mar 2, 2012 at 08:56, Romeo Theriault <romeo.theria...@maine.edu> 
>> wrote:
>> > [...] one item I can't seem to find a clean way of dealing
>> > with is one-off nodes. For example, let's say I want to apply a class
>> > called zabbix::agent to my whole infrastructure, so I put it in
>> > common.yaml. But then I find out there are a few nodes that for
>> > whatever reason I can't apply this class to. Short of just not
>> > inheriting anything from common.yaml is there a clean way to say
>> > "inherit everything from common except zabbix::agent"?
>>
>> > How are people dealing with the slight variations in their
>> > infrastructure? I realize it's possible to code some logic into the
>> > classes for these specific one-off hosts but that seems really hackish
>> > and brittle.
>>
>> After a bit more googling I found this informative puppet-users thread:
>>
>> http://groups.google.com/group/puppet-users/browse_thread/thread/6b59...
>>
>> which talks about creating special "disabled" classes which inherit
>> the widely used class and set certain values to 'undef'. This seems
>> like it's probably the way to go since it's the best method I've
>> seen/heard of so far to deal with this.
>
>
> That is one of the standard approaches to the kind of problem you
> describe, and it is simultaneously one of the few appropriate uses for
> class inheritance.  The post you referenced provides a rather specific
> solution, however, and your description of it suggests that you may
> not yet see how that generalizes.
>
> In particular,
> 1) Overriding resource properties is the entire purpose of class
> inheritance.
> 2) A subclass can override resource properties to any value, not just
> undef.  In fact, I think overriding to undef is unusual.
> 3) Although setting a resource property to undef generally means that
> *property* is unmanaged, that's a very different thing from making the
> entire resource be unmanaged.
> 4) Not managing a resource (or property) is very different from
> managing it to an atypical state.  Either might be what you want.
>
>
>> Anyone else dealing with this in a different way?
>
>
> Not I, but I can offer some alternatives anyway.  Hiera provides
> several:
>
> A) Put an if block in Class['zabbix-agent'] around everything else in
> the class body.  Use hiera to look up the value controlling whether
> the condition is satisfied.  That provides an opt-out that any node
> can be made to use simply by setting an appropriate value in its hiera
> data.
>
> B) As I recall (but have not used), hiera provides an ENC-like
> function whereby you can cause it to declare classes for your nodes
> based on class names it looks up in your data.  You could use that to
> decide whether to apply Class['zabbix-agent'] instead of declaring it
> in a class / node declaration that every node uses.  Leverage hiera's
> hierarchical structure.
>
> C) Instead of overriding certain resource properties in a subclass,
> have the erstwhile parent class use hiera to look up the wanted
> property values in the first place.  This is a general-purpose
> alternative to class inheritance.
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> 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.
>



-- 
Romeo

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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