Issue #13279 has been updated by R.I. Pienaar.

Possibly related to #5876
----------------------------------------
Bug #13279: File resource runs when 'require'ed Exec fails but only if 
refreshonly is enabled
https://projects.puppetlabs.com/issues/13279#change-60474

Author: Tim  Nicholas
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


If I have an exec with "refreshonly => true," and a file resource with a 
"require => Exec['the_exec']" then the file resource is still run, even when 
the exec fails. 

If I remove the "refreshonly => true" flag, then the exec failing prevents the 
file resource from being applied (as I would expect). 



For example (note that in the run with refreshonly=true there is no failed 
dependency): 
<pre>
08:57:41 root@puppetmaster ~# cat exec_test_refreshonly.pp
file { "/tmp/file1" :
 source => "/tmp/sourcefile",
 notify => Exec["fail_please"],
}

exec { "fail_please" :
 command     => "false",
 path        => [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ],
 refreshonly => true,
}

# should only happen when false is true... or something.
file { "/tmp/file2" :
 source  => "/tmp/file1",
 require => Exec["fail_please"],
}
09:08:09 root@puppetmaster ~# echo $RANDOM > /tmp/sourcefile && puppet apply -v 
exec_test_refreshonly.pp
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1332148099'
info: FileBucket adding {md5}1c813ffc6daeb0c69778b0ebdccdb2f8
info: /Stage[main]//File[/tmp/file1]: Filebucketed /tmp/file1 to puppet with 
sum 1c813ffc6daeb0c69778b0ebdccdb2f8
notice: /Stage[main]//File[/tmp/file1]/content: content changed 
'{md5}1c813ffc6daeb0c69778b0ebdccdb2f8' to 
'{md5}9e10f28b803a16ca9309c268cac96ec8'
info: /Stage[main]//File[/tmp/file1]: Scheduling refresh of Exec[fail_please]
err: /Stage[main]//Exec[fail_please]: Failed to call refresh: false returned 1 
instead of one of [0] at /root/exec_test_refreshonly.pp:10
info: FileBucket got a duplicate file {md5}1c813ffc6daeb0c69778b0ebdccdb2f8
info: /Stage[main]//File[/tmp/file2]: Filebucketed /tmp/file2 to puppet with 
sum 1c813ffc6daeb0c69778b0ebdccdb2f8
notice: /Stage[main]//File[/tmp/file2]/content: content changed 
'{md5}1c813ffc6daeb0c69778b0ebdccdb2f8' to 
'{md5}9e10f28b803a16ca9309c268cac96ec8'
notice: Finished catalog run in 0.12 seconds
09:08:20 root@puppetmaster ~#


09:08:20 root@puppetmaster ~# cat exec_test_without_refreshonly.pp file { 
"/tmp/file1" :
 source => "/tmp/sourcefile",
 notify => Exec["fail_please"],
}

exec { "fail_please" :
 command     => "false",
 path        => [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ],
}

# should only happen when false is true... or something.
file { "/tmp/file2" :
 source  => "/tmp/file1",
 require => Exec["fail_please"],
}
09:08:29 root@puppetmaster ~# echo $RANDOM > /tmp/sourcefile && puppet apply -v 
exec_test_without_refreshonly.pp
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1332148116'
info: FileBucket adding {md5}9e10f28b803a16ca9309c268cac96ec8
info: /Stage[main]//File[/tmp/file1]: Filebucketed /tmp/file1 to puppet with 
sum 9e10f28b803a16ca9309c268cac96ec8
notice: /Stage[main]//File[/tmp/file1]/content: content changed 
'{md5}9e10f28b803a16ca9309c268cac96ec8' to 
'{md5}3ccd0e68774ff79817a260b003c75ab8'
info: /Stage[main]//File[/tmp/file1]: Scheduling refresh of Exec[fail_please]
err: /Stage[main]//Exec[fail_please]/returns: change from notrun to 0 failed: 
false returned 1 instead of one of [0] at 
/root/exec_test_without_refreshonly.pp:9
err: /Stage[main]//Exec[fail_please]: Failed to call refresh: false returned 1 
instead of one of [0] at /root/exec_test_without_refreshonly.pp:9
notice: /Stage[main]//File[/tmp/file2]: Dependency Exec[fail_please] has 
failures: true
warning: /Stage[main]//File[/tmp/file2]: Skipping because of failed dependencies
notice: Finished catalog run in 0.17 seconds
09:08:37 root@puppetmaster ~#
</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.

Reply via email to