Issue #7486 has been updated by Nigel Kersten.

Assignee set to Nigel Kersten

John Florian wrote:
> If execution order is the only criteria, the "before" meta-parameter is 
> appropriate.  However, if a declared state is the criteria, "require" would 
> be appropriate.  What we presently have greatly weakens effective 
> expressiveness in the DSL.

The choice of the word "require" is part of the problem. Really the semantics 
are more like "If this other resource is going to be evaluated, then make sure 
it is evaluated before I am".

The way tags work illustrate this. If Resource A requires Resource B, A is 
tagged "foo", B is not, and you run with "--tags=foo", A is still evaluated, 
even though B isn't.

To bring this back to your problem, I'm worried we have people relying upon the 
existing behavior, and that if we made a change such that a resource with 
failed dependencies doesn't respond to any events sent to it, this might be 
undesirable for them.

This is why we're going to take this to the community. I'll get onto that soon.
----------------------------------------
Bug #7486: Service refreshed despite failed dependencies
https://projects.puppetlabs.com/issues/7486

Author: John Florian
Status: Needs Decision
Priority: Normal
Assignee: Nigel Kersten
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