On Jan 24, 3:51 am, Alexandre <[email protected]> wrote:
> > 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.
>
> I see. I was making a difference between parsing the notified
> ressource and applying this resource. That is why i -though- the
> notify would require the parsing, but Puppet would then apply/refresh
> the notified resource afterwards. But it seems that for Puppet,
> parsing and applying the notified ressource is one operation, which
> means, if i understand correctly, that it is not possible to require
> and notify the same resource as i was expecting erroneously.


No, that is incorrect.  Parsing and applying are always distinct
operations to Puppet.  In general, they don't even happen on the same
machine.

Testing for dependency cycles is part of parsing manifests and
compiling them into a catalog.  This does not conflict with Felix's
explanation of why 'subscribe' and 'notify' [must] establish resource
relationships.

Perhaps you meant you thought the 'require' was needed for correct
parsing?  That is incorrect, precisely *because* Puppet separates
parsing / compiling from applying, but we need to be careful because
you use two semantically different 'require's in your manifest:

1) The 'require' function --
require 'apache'

2) The 'require' metaparameter --
require => [ Class['apache'] ]

You must first understand that the latter is redundant with the
former, because the former causes the entire class in which it appears
to have a requirement on the named class.  This is an order-of-
application consideration, not a parsing consideration, and it seems
to be the key problem in your manifest.

The 'require' function (but not the metaparameter) ADDITIONALLY has
the same effect as the 'include' function, and part of *that* effect
is indeed necessary to ensure that your manifest always parses
cleanly.  Perhaps this is the source of your confusion.

It looks like what you want might be


modules/apache/manifests/init.pp:
====
    class apache {
        #(...)
        exec { 'apache-reload':
            command     => '/sbin/service httpd reload',
            refreshonly => true,
            require     => Service['apache'],
        }
    }


modules/backup/manifests/backuppc/web.pp:
====
    class backup::backuppc::web {
        #(...)

        include 'apache'  # NOTE

        file { '/etc/httpd/conf.d/BackupPC.conf':
            #(...)
            # NO REQUIRE
            notify  => Exec['apache-reload'],
        }
    }


John

-- 
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.

Reply via email to