Issue #5414 has been updated by Ben -.
Nigel Kersten wrote:
> The original bug around the notify was unintended behavior in 0.25.x. If you
> can describe your needs at a higher level, we can probably come up with an
> alternative.
I have been using puppet to notify on local file changes recursively for
forever and every version prior to 2.6 has done it. Are you saying that it
shouldn't have?
One example, and the one that alerted me to the problem in the first place, is
my dansguardian module.
class dansguardian {
package { "dansguardian": ensure => "2.10.1.1-1.el5";
"rl": ensure => installed;
}
service { "dansguardian": enable => true, ensure => running,
require => [ File["/etc/dansguardian/dansguardian.conf"],
Service["squid"],
Service["clamd.dansguardian"]
]
}
file { "/etc/dansguardian/dansguardian.conf":
source => [
"${fserver}/modules/dansguardian/dansguardian.conf.${domain_0}",
"${fserver}/modules/dansguardian/dansguardian.conf" ],
require => Package["dansguardian"],
notify => Service["dansguardian"];
"/etc/dansguardian/contentscanners/clamdscan.conf":
source => [
"${fserver}/modules/dansguardian/clamdscan.conf.${domain_0}",
"${fserver}/modules/dansguardian/clamdscan.conf" ],
require => Package["dansguardian"],
notify => Service["dansguardian"];
"/opt/dansguardian/lists/blacklists":
ensure => directory, recurse => true, checksum => mtime, mode =>
644, notify => Exec["install_dansguardian_lists"],
require =>
Exec["/etc/cron.hourly/rsync_dansguardian_blacklists.sh 1"];
"/etc/dansguardian/lists/phraselists":
ensure => directory, recurse => true, checksum => mtime, mode =>
644,
ignore => "*.processed", notify => Service["dansguardian"];
"/usr/sbin/install_dansguardian_lists.sh": source =>
"${fserver}/modules/dansguardian/install_dansguardian_lists.sh", mode => 750;
"/etc/cron.hourly/rsync_dansguardian_blacklists.sh": source =>
"${fserver}/modules/dansguardian/rsync_dansguardian_blacklists.cron", mode =>
750, require => Package["rl"] ];
}
exec { "/usr/sbin/install_dansguardian_lists.sh
/opt/dansguardian/lists/blacklists":
refreshonly => true, alias => "install_dansguardian_lists",
require => [ File["/usr/sbin/install_dansguardian_lists.sh"],
Package["rl", "rsync"] ],
notify => Service["dansguardian"];
# --- this is a one time primer.
"/etc/cron.hourly/rsync_dansguardian_blacklists.sh 1":
creates => "/etc/dansguardian/lists/blacklists/white",
require => [
File["/etc/cron.hourly/rsync_dansguardian_blacklists.sh"], Package["rsync"] ],
notify => Exec["install_dansguardian_lists"];
}
}
So, the idea here is that cron and
File["/etc/cron.hourly/rsync_dansguardian_blacklists.sh"] maintain the sorted
blacklists in "/opt/dansguardian/lists/blacklists" from a central rsync repo
and puppet checksums (mtime) all files recursively in
"/opt/dansguardian/lists/blacklists" and on any change it notifies
Exec["install_dansguardian_lists"] which inturn shuffles the blacklists,
dansguardian prefers unsorted lists, and installs then in
"/etc/dansguardian/lists/blacklists" and notifies Service["dansguardian"].
$ du -sh /opt/dansguardian/lists/blacklists/
35M /opt/dansguardian/lists/blacklists/
$ find /opt/dansguardian/lists/blacklists -type f | wc -l
82
cron and File["/etc/cron.hourly/rsync_dansguardian_blacklists.sh"] also
maintain lists in "/etc/dansguardian/lists/phraselists" and puppet should
notify Service["dansguardian"] on any changes there too.
I hope that is all clear as I have chopped the class down to only include to
important stuff.
----------------------------------------
Bug #5414: file resource can't be used to monitor file changes recursively
https://projects.puppetlabs.com/issues/5414
Author: Ben -
Status: Investigating
Priority: Low
Assignee: Nigel Kersten
Category: file
Target version:
Affected Puppet version: 2.6.3
Keywords:
Branch:
for a long time i have used puppet to monitor a directory recursively for file
changes but since upgrading to 2.6 that doesn't appear to work.
# file_test.pp
file { "/tmp/file_test":
ensure => directory, recurse => true,
checksum => mtime, mode => 644, notify => Exec["tar"];
}
exec { "/bin/tar -cf - /tmp/file_test > /dev/null": alias => "tar",
refreshonly => true; }
Using the above manifest the following does not act as expected.
puppet apply --verbose file_test.pp # creates /tmp/file_test and runs exec
as expected
mkdir /tmp/file_test/{1,2,3,4,5,6}
puppet apply --verbose file_test.pp # does nothing, should run exec
puppet apply --verbose file_test.pp # does nothing, should do nothing
touch /tmp/file_test/{1,2,3,4,5,6}/{10,11,12,15}
puppet apply --verbose file_test.pp # does nothing, should run exec
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en.