Issue #2682 has been updated by Peter Meier.
Status changed from Unreviewed to Needs design decision
the problem you encounter comes from the feature that puppet can also simply
watch files without managing any content at all and do things when they change.
So in this case this behavior totally makes sense.
As your desired behavior is to place a file on the initial run and then start
the service, you could also simply use before instead of notify. assuming your
installing the package and the file in the same run.
For sure if you want to simply watch files you don't need to set replace to
false, otherwise only trigger notify's action depending on this flag would make
everything very magic.
----------------------------------------
Bug #2682: file {...}: replace => false, notify => Service[...] always triggers
notify if md5sums do not match
http://projects.reductivelabs.com/issues/2682
Author: Mirko Gebauer
Status: Needs design decision
Priority: Normal
Assigned to:
Category: file
Target version:
Affected version: 0.24.8
Keywords:
Branch:
Hi,
I've written a class to manage our local tomcat installations and presumably
discovered a bug with the combination of "replace => false, notify =>
Service[...]" in the "file" type. Here's the relevant code snippet:
@class tomcat {
include "java"
define provider($ensure, $jdk, $adminpass, $managed = true) {
{...}
file { "/etc/$name/tomcat-users.xml":
content => template("common/etc/$name/tomcat-users.xml.erb"),
owner => $name ? {
default => "$name",
"tomcat5.5" => "tomcat55",
},
group => $name ? {
default => "adm",
"tomcat5.5" => "nogroup",
},
mode => $name ? {
default => "0640",
"tomcat5.5" => "0644",
},
replace => $managed,
require => Package["$name"],
notify => Service["$name"],
}
{...}
}
}@
Call on corresponding node:
@tomcat::provider { "tomcat5.5": ensure => installed, jdk => "sun-java6-jdk",
adminpass => "something", managed => false }@
Now unfortunately, if the content of "/etc/$name/tomcat-users.xml" differs from
the one provided by the template file, "notify => Service["$name"]" will
restart the corresponding tomcat service every time the file is checked, even
though I had expected that notify would only be triggered if "replace => true",
not for "replace => false". With other words, the file correctly won't be
replaced, but notify incorrectly is triggered.
ad...@hudson:/var/log$ sudo puppetd --verbose --server puppetmaster.localdomain
--test --noop
info: Caching catalog at /var/lib/puppet/state/localconfig.yaml
notice: Starting catalog run
notice:
//Node[hudson.localdomain]/Tomcat::Provider[tomcat5.5]/File[/etc/tomcat5.5/tomcat-users.xml]/checksum:
is {md5}fcc2a978591dc7890fcc3db84bcc2d18, should be md5 (noop)
info:
//Node[hudson.localdomain]/Tomcat::Provider[tomcat5.5]/File[/etc/tomcat5.5/tomcat-users.xml]:
Scheduling refresh of Service[tomcat5.5]
notice:
//Node[hudson.localdomain]/Tomcat::Provider[tomcat5.5]/Service[tomcat5.5]:
Would have triggered refresh from 1 dependencies
notice: Finished catalog run in 9.92 seconds
Please correct me if I'm doing something wrong, but I consider this a bug since
the behaviour of the "file" type does not match the user's expectations.
--
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://reductivelabs.com/redmine/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
-~----------~----~----~----~------~----~------~--~---