Chris Hirsch
2012-Nov-07 20:56 UTC
[Puppet Users] Puppet creates a file even though an exec fails
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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Mason Turner
2012-Nov-07 20:58 UTC
Re: [Puppet Users] Puppet creates a file even though an exec fails
You want "refreshonly => true" on file2, as well. On Nov 7, 2012, at 3:56 PM, Chris Hirsch <chris@base2technology.com> wrote:> 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 > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Chris Hirsch
2012-Nov-07 21:18 UTC
Re: [Puppet Users] Puppet creates a file even though an exec fails
Except my resource is a File and not an Exec. refreshonly is invalid for a File afik. Are there alternatives you may suggest to accomplish the same?> You want "refreshonly => true" on file2, as well. > > On Nov 7, 2012, at 3:56 PM, Chris Hirsch <chris@base2technology.com> wrote: > >> 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 >> >> >> -- >> You received this message because you are subscribed to the Google Groups "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. >> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-Nov-07 21:24 UTC
Re: [Puppet Users] Puppet creates a file even though an exec fails
----- Original Message -----> From: "Chris Hirsch" <chris@base2technology.com> > To: puppet-users@googlegroups.com > Sent: Wednesday, November 7, 2012 9:18:15 PM > Subject: Re: [Puppet Users] Puppet creates a file even though an exec fails > > > Except my resource is a File and not an Exec. refreshonly is invalid > for a File afik. Are there alternatives you may suggest to > accomplish the same?I believe this is http://projects.puppetlabs.com/issues/5876 in action :( -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Chris Hirsch
2012-Nov-07 21:38 UTC
Re: [Puppet Users] Puppet creates a file even though an exec fails
>> >> >> Except my resource is a File and not an Exec. refreshonly is invalid >> for a File afik. Are there alternatives you may suggest to >> accomplish the same? > > I believe this is http://projects.puppetlabs.com/issues/5876 in action :( >Bummer! Especially since I added a me-too to that bug over a year ago. I guess I''ll have to re-think my implementation. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Chris Hirsch
2012-Nov-07 22:36 UTC
Re: [Puppet Users] Puppet creates a file even though an exec fails
This example *may* be able to get me though this: file{"/tmp/file1": content=>"file1"} ~> exec{ "/bin/false": refreshonly => true, notify => Exec["file2"]} -> exec {"file2": command => "touch /tmp/file2", refreshonly => true } of course I''ll have to create the file though the file2 exec instead. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.