On Dec 21, 4:38 pm, Douglas Garstang <doug.garst...@gmail.com> wrote:
> I'd like to be able to put specific modules into 'maintenance' mode if a
> variable has been set. I can check the variable, but the only way I can see
> to have puppet skip processing is to use the fail() function, which stops
> everything with a nasty error message. Is there a return() function or
> similar???
>
> Doug.

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")
}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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