On 5 May 2011 14:04, jcbollinger <[email protected]> wrote:
>
>
> On May 3, 3:56 pm, Chris Phillips <[email protected]> wrote:
> > Hi,
> >
> > I don't know if I'm just not getting it, but I'm struggling to find
> > "the" way to elegantly disable a class in its entirety. I am aware of
> > the foo::disabled conventions, but these are about the disabling of
> > the end service defined by the class, not the class itself.
>
>
> [...]
>
>
> > So again, I just want to wipe out the impact of the class, unmanage as
> > it were, replace the contents with a nice simple { } regardless of
> > what it was written to do maybe, not force disabling of the end
> > result, and I'm assuming there is a great and painfully simple way to
> > do this with style, but it's missing me right now.
>
>
> There is no way to achieve precisely what you ask. Instead, you must
> avoid including the class in the node's catalog in the first place.
> Use conditional statements in your manifests (if / case) to select
> based on nodes' facts whether to include it, or include it only for
> certain nodes (which amounts to the same thing).
>
> From the perspective of designing an ENC, you should be looking to add
> classes to a common base rather than subtract classes from an omnibus
> configuration. For what it's worth, I think that would still be a
> better design paradigm even if Puppet could provide the alternative.
>
>
> John
>
Thanks John, appreciated. Whilst I totally see the logic in adding to a
base, if 99% of machines want all these classes, and only a
real exception would this be deviated from (indeed I currently have no
deviations, but don't want to be caught by it when it's sure to come along)
the base is going to be irrelevant if some of the "99%" modules aren't in
it.
I've come up with this methodology which seems to technically work...
===========
class baseclass {
$classes = ["aaa", "access", "banner", "func", "hosts", "munin", "ntp",
"resolv", "rhn", "rsyslog", "ssh", "sudo"]
define include_class() {
if ($exclude_classes == undef) or ! ($name in $exclude_classes) {
include $name
}
}
include_class{ $classes: }
}
node default {
include baseclass
}
===========
So under puppet dashboard I can create a variable called "exclude_classes"
and give it in array of class names, and while iterating through a list of
defaults, if the candidate class is in the exclude_classes list it won't be
included.
Any thoughts / style tips would be very much appreciated, as this still
feels wrong, but I'd love it if it wasn't! Is it good to have a baseclass
there when that code could all be direct within the default node?
Thanks
Chris
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
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.