On 01/24/2012 10:09 AM, Alexandre Fouch� wrote:
> I find it logical that my 'BackupPC.conf' apache file is put after the
> apache package is installed, or more broadly after the apache class is
> complete. Afterwards, i put the 'BackupPC.conf' conf, and then
> afterwards, i want to notify Exec['apache-reload'], that it needs to
> reload. To me, the notify is a good way to ensure the apache class does
> not have to know anything about the backup class, and stay generic,
> while at the same time ensuring that the backup class can notify the
> apache service if it thinks it needs to.
Your outset looks a bit contradictory to me. Yes, requiring
Class["apache"] is sound design. But notifying a resource decalred
*within* that class is the complete opposite of that.
A better solution will take care of your problem as well.
> Unfortunately, the 'notify' is acting as a 'before' and creates a
> dependency cycle. It breaks the scheme of being able to keep the apache
> class generic yet able to respond to notifications
Think about it. You want puppet to send a notification to a resource.
Puppet must decide whether this notification gets sent. So it must
process the notifying resource. After that, *if* a notification was in
fact generated, it can process the notified resource. The opposite order
cannot be achieved. Therefore, notifies and subscriptions imply
before/requires relationships.
I suggest you add a class
apache::service {
...
}
with whatever implementation you choose for your reload (in most cases
you want to notify a service resource instead of an exec, but it's not
more than a rule of thumb).
The you can go ahead and require Class[apache] but notify
Class[apache::service]. For good measure, class apache will likely
include apache::service.
Hope this makes sense to you.
Cheers,
Felix
It's not. Both notify and require operate *only* on the order in which
the *agent* will apply resources.
Parsing happens on the master. There is no reason you would change its
order.
I sense we're still talking in circles so to make it yet more clear:
The decision wether an applied resource needs changing (I believe you
refer to this decision as "parsing") is indeed made at the time of
resource application and there is no way to separate these steps.
HTH,
Felix