On Tuesday, January 12, 2016 at 3:46:42 PM UTC-6, Johan Martinez wrote: > > > I want to notify a service whenever certain config files change. Rather > than putting notify function in every resource, can class level notify with > chaining arrow/tilda work here? > > I am referring to > https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html#syntax-chaining-arrows > > . > > I have defined multiple file resources inside config class. Will something > like below notify service class if any of the resources in config class are > applied/changed? > > Class['site::config'] ~> Class['site::service'] > > TL;DR: yes.
In more detail, the Language Reference describes how containment interacts with event broadcast and reception <http://docs.puppetlabs.com/puppet/4.3/reference/lang_relationships.html#refreshing-and-notification> (the mechanism underlying resource notification and refreshing). In particular, If Puppet changes (or refreshes) any resource in a class or defined > resource, that class or defined resource will send a refresh event to any > subscribed resources. > and If a class or defined resource gets a refresh event, every resource it > contains will also get a refresh event. > Those both apply to the example you presented. One thing to watch out for, however, is that the event broadcasting produced by a declaration such as you presented may be more than you actually want. That is, there must not be any resources in Class['site::config'] from which you do not want to receive events, nor any in Class['site::service'] to which the events should not be directed. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/dec4c676-6be7-4914-a9e4-31465c929d38%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.