Issue #7486 has been updated by Nigel Kersten.

Priority changed from Urgent to Normal

This is actually by design unfortunately.

When a resource requires another (failed) resource, it is marked as "skipped". 
When a resource subscribes (or is notified by) a (successful) resource, the 
event that is sent at that point triggers the refresh action on the original 
resource.

It's not really "ignoring the failed dependency", it's actually doing something 
different, which is to issue a refresh, which for a service by default will 
stop and start the service. This is a different thing to "ensure this service 
is running".

I do think this is problematic. It does violate the principle of least 
surprise, but we're not clear on what semantics we need to add/modify in order 
to get to a better place.  Suggestions welcome... but I'm planning to try to 
get community feedback in the near future so that we can make the required 
changes for Telly.

Does that make sense at least?


----------------------------------------
Bug #7486: Service refreshed despite failed dependencies
https://projects.puppetlabs.com/issues/7486

Author: John Florian
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 0.25.5
Keywords: 
Branch: 


In the following manifest, I would expect the service to not be restarted if
either File results in a failure, however that's not the case:

<pre>
# dependency-test.pp

file { "/tmp/test/xyz/A":
    content     => 'file A',
}

file { "/tmp/test/B":
    content     => 'file B',
}

service { "crond":
    enable      => true,
    ensure      => running,
    hasrestart  => true,
    hasstatus   => true,
    require     => [
        File['/tmp/test/xyz/A'],
    ],
    subscribe   => [
        File['/tmp/test/B'],
    ],
}
</pre>

Here's the results I get:

<pre>
# cd /tmp; rm -rf test; mkdir test
# service crond status; puppet -v dependency-test.pp; service crond status
crond (pid  28753) is running...
info: Applying configuration version '1305125236'
err: //File[/tmp/test/xyz/A]/content: change from absent to 
{md5}31d97c4d04593b21b399ace73b061c34 failed: No such file or directory - 
/tmp/test/xyz/A.puppettmp_7091
notice: //File[/tmp/test/B]/content: defined content as 'unknown checksum'
info: //File[/tmp/test/B]: Scheduling refresh of Service[crond]
notice: //Service[crond]: Dependency file[/tmp/test/xyz/A] has 1 failures
warning: //Service[crond]: Skipping because of failed dependencies
notice: //Service[crond]: Triggering 'refresh' from 1 dependencies
crond (pid  28937) is running...
# puppet --version
0.25.5
</pre>

File A's failure (because subdir xyz doesn't exist) is intentional here to
demonstrate how the service gets restarted despite all dependencies not being
satisfied.  My understanding is that subscribe implies a depenency.  However,
I even tried adding File B to the require clause and got the exact same
results, the service was started because File B sent a notify (as it should)
and puppet ignored the failed dependency for File A (as it should not).

I have an application in which the service absolutely must not start unless
all dependencies are satisfied.

This may be related to #5876.



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

Reply via email to