[Puppet Users] Puppet creates a file even though an exec fails

Chris Hirsch
Wed, 07 Nov 2012 20:56:34 -0000

Hi all,

I''m trying to figure out if my expectations are correct for this class.
Basically I''d like to have file1 created and then run an exec. If that
exec should fail file2 should NOT be created.
Currently as you can see from the below output, the refresh failed yet file2 was
still created.

class christest {
   file{"/tmp/file1": content=>"file1"} ~> exec{
"/bin/false": refreshonly => true} -> file
{"/tmp/file2": content=>"file2"}
}

puppet --version
2.7.17

puppet agent --test

notice: /Stage[main]/Christest/File[/tmp/file1]/ensure: defined content as
''{md5}826e8142e6baabe8af779f5f490cf5f5''
info: /Stage[main]/Christest/File[/tmp/file1]: Scheduling refresh of
Exec[/bin/false]
err: /Stage[main]/Christest/Exec[/bin/false]: Failed to call refresh: /bin/false
returned 1 instead of one of [0] at
/etc/puppet/environments/chirsch/modules/christest/manifests/init.pp:2
notice: /Stage[main]/Christest/File[/tmp/file2]/ensure: defined content as
''{md5}1c1c96fd2cf8330db0bfa936ce82f3b9''
notice: Finished catalog run in 0.27 seconds