Issue #5876 has been updated by Ken Barber.
Category set to exec
I concur - I've also seen this in classes. It only seems to happen with
'refresh => only'.
Of course one would ponder what is the right thing to do in cases like this:
#file { "file1":
# path => "/tmp/broken1",
# content => "broken",
# notify => Exec["exec1"],
#}
exec { "exec1":
command => "/usr/bin/false",
refreshonly => true,
before => File["file2"],
}
file { "file2":
path => "/tmp/broken2",
content => "broken",
}
By commenting out the file I'm trying to emulate the behaviour of an exec that
isn't refreshed due to perhaps its file not being changed. The exec is invalid
and will fail, but without a proper run how would the file determine this?
I think the problem is more complicated, but regardless it is surprising when
you do get a failure as Jason is showing that the file installs regardless.
My point is even if you fixed _that_ behaviour - the pattern would be useless.
Right? If you made a require _force_ an exec as a check first that would break
the inherent meaning of 'refreshonly' on the exec so this is not a solution
either.
So therefore - I think for this use-case at least the model is broken not just
the implementation.
Jason Slagle wrote:
> Came across this class during training here at puppetconf attempting to
> validate the sudoers file in an example.
>
> At least 3 seperate people in my class hit this issue - it's very surprising
> and frustrating.
>
> +1 on raising the priority back to urgent - this isn't a POLA thing here - it
> seems to have been broken and I can't see how fixing it would surprise people?
>
> Here's another simple test case that models what we were doing in class:
>
> [...]
----------------------------------------
Bug #5876: Require and Subscribe on the same refreshonly exec doesnt work
https://projects.puppetlabs.com/issues/5876
Author: R.I. Pienaar
Status: Needs Decision
Priority: Normal
Assignee: Nick Lewis
Category: exec
Target version: 2.6.x
Affected Puppet version: 0.25.4
Keywords:
Branch:
Given this manifest:
<pre>
exec{"moo":
command => "/usr/bin/cowsay 'fail :('",
refreshonly => true,
logoutput => true,
require => Exec["false"],
subscribe => [ File["/tmp/1"], File["/tmp/2"], File["/tmp/3"] ]
}
file{"/tmp/1": content => 1}
file{"/tmp/2": content => 2}
file{"/tmp/3": content => 3}
exec{"false": command => "/bin/false"}
</pre>
The Exec[moo] shouldn't run it requires Exec[false] which will always fail, but
it gets notified by the file resources via its subscribes and then runs anyway
regardless of the state of the required resources.
In version 2.6.5 this might be related to #5670 but I am filing a new bug since
I think its not as this bug is also present in 0.25.x while the one in #5670 is
2.6.x only
<pre>
notice: //File[/tmp/1]/content: defined content as 'unknown checksum'
notice: //File[/tmp/3]/content: defined content as 'unknown checksum'
err: //Exec[false]/returns: change from notrun to 0 failed: /bin/false returned
1 instead of one of [0] at /home/rip/test.pp:12
notice: //File[/tmp/2]/content: defined content as 'unknown checksum'
notice: //Exec[moo]: Dependency exec[/bin/false] has 1 failures
warning: //Exec[moo]: Skipping because of failed dependencies
notice: //Exec[moo]: Triggering 'refresh' from 3 dependencies
notice: //Exec[moo]/returns: _________
notice: //Exec[moo]/returns: < fail :( >
notice: //Exec[moo]/returns: ---------
notice: //Exec[moo]/returns: \ ^__^
notice: //Exec[moo]/returns: \ (oo)\_______
notice: //Exec[moo]/returns: (__)\ )\/\
notice: //Exec[moo]/returns: ||----w |
notice: //Exec[moo]/returns: || ||
</pre>
--
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.