There's no way to 'uninclude' a class once it's in the catalog. I'd
probably do this with an include one level up which determines whether
to do the work or not. Does this example make sense?
class service1 {
if $service1_state == "enabled" {
include service1::enabled
} else {
maintenance{ $name: } # $name refers to the class, issue #1104
}
}
class service1::enabled {
# Do actual work here
service { "service1": enabled => true }
}
# just a cheap wrapper to log on both client and server
define maintenance($message="in maintenance mode") {
notify{
"$name": loglevel => 'warning', message => "$name $message"
}
warning("$name $message")
}