Swati Tiwari
2009-Jun-26 23:52 UTC
[Puppet Users] exec : creates parameter does not create the file
Hello guys, I am facing this problem. I have an exec resource which has a create parameter. The catalog runs properly but the file is not created, has anyone faced such a problem? My manifest is class example { exec { "sources": command => "/usr/bin/sudo /usr/bin/gem sources -a http://gems.github.com", creates => "/tmp/githubadded" } } The command runs fine but it does not create /tmp/githubadded file. I also have write permission on this directory. Any help would be appreciated. Thanks! -- Regards, Swati --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Avi Miller
2009-Jun-27 00:00 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
Swati Tiwari wrote:> The command runs fine but it does not create /tmp/githubadded file.I think you''re misunderstanding the parameter. The exec resource does not create this file. It assumes whatever it is exec''ing will create the file. So, it will keep running the exec until this file is created by the process being run. Hope that makes more sense. Avi --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steven VanDevender
2009-Jun-27 00:01 UTC
[Puppet Users] exec : creates parameter does not create the file
Swati Tiwari writes: > Hello guys, > > I am facing this problem. I have an exec resource which has a create > parameter. The catalog runs properly but the file is not created, has anyone > faced such a problem? > My manifest is > > class example > { > exec { "sources": > command => "/usr/bin/sudo /usr/bin/gem sources -a > http://gems.github.com", > creates => "/tmp/githubadded" > } > } > > The command runs fine but it does not create /tmp/githubadded file. Then why do you have ''creates => "/tmp/githubadded"'' in your class? If the command "/usr/sbin/sudo /usr/bin/gem sources -a http;//gems.github.com" doesn''t create the file "/tmp/githubadded", then Puppet will run the command over and over. Normally you use "creates" in an "exec" if you want the "exec" to run if some specified file or directory doesn''t exist, and the command run by the "exec" needs to create the file or directory you name with "creates". > I also have write permission on this directory. Note also that it is common for /tmp to be cleared out every time you reboot a system, so if you are trying to use this to install software for later use, this may attempt a reinstall when it is unnecessary to do so. > Any help would be appreciated. Thanks! I also have to wonder why you use "sudo" in the command, since the Puppet client normally runs as root, and if not run as root "sudo" normally prompts for a password. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Scott Smith
2009-Jun-27 00:03 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
Swati Tiwari wrote:> The command runs fine but it does not create /tmp/githubadded file. I > also have write permission on this directory. Any help would be > appreciated. Thanks! ><< creates A file that this command creates. If this parameter is provided, then the command will only be run if the specified file does not exist: >> This means Puppet uses the file specified in your creates directive to determine if it needs to run the command again. Neither `sudo'' nor `gem'' create the file `/tmp/githubadded'', so it will always execute this Exec resource. -scott -- scott@ohlol.net http://github.com/ohlol --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Swati Tiwari
2009-Jun-27 00:11 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
Got it! Thank you! I did this and it worked! exec { "sources": command => "sudo gem sources -a http://gems.github.com/ > /tmp/githubadded", creates => "/tmp/githubadded" } I hope that''s the right way to do it... 2009/6/26 Scott Smith <scott@ohlol.net>> > Swati Tiwari wrote: > > The command runs fine but it does not create /tmp/githubadded file. I > > also have write permission on this directory. Any help would be > > appreciated. Thanks! > > > > << > creates > > A file that this command creates. If this parameter is provided, then > the command will only be run if the specified file does not exist: > >> > > This means Puppet uses the file specified in your creates directive to > determine if it needs to run the command again. Neither `sudo'' nor `gem'' > create the file `/tmp/githubadded'', so it will always execute this Exec > resource. > > -scott > > -- > scott@ohlol.net > > http://github.com/ohlol > > > >-- Regards, Swati --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Peter Meier
2009-Jun-27 14:54 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
Hi> exec { "sources": > command => "sudo gem sources -a http://gems.github.com/ > > /tmp/githubadded", > creates => "/tmp/githubadded" > } > > I hope that''s the right way to do it...I would rather do: exec { "sources": command => "sudo gem sources -a http://gems.github.com/", unless => ''gem source -l | grep -q gems.github.com'', } which is more idempotent. /tmp is thought only for temporary files. on the different systems this file will be missing after a certain amount of time or after a reboot. hence puppet would rerun the exec again. cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Swati Tiwari
2009-Jun-28 00:40 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
That''s definitely way better than what I was planning on doing, thanks Peter! 2009/6/27 Peter Meier <peter.meier@immerda.ch>> > Hi > > > exec { "sources": > > command => "sudo gem sources -a http://gems.github.com/ > > > /tmp/githubadded", > > creates => "/tmp/githubadded" > > } > > > > I hope that''s the right way to do it... > > > I would rather do: > > exec { "sources": > command => "sudo gem sources -a http://gems.github.com/", > unless => ''gem source -l | grep -q gems.github.com'', > } > > which is more idempotent. > > /tmp is thought only for temporary files. on the different systems this > file will be missing after a certain amount of time or after a reboot. > hence puppet would rerun the exec again. > > cheers pete > > > >-- Regards, Swati --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Marcin Owsiany
2009-Jun-28 10:14 UTC
[Puppet Users] Re: exec : creates parameter does not create the file
On Sat, Jun 27, 2009 at 04:54:44PM +0200, Peter Meier wrote:> > Hi > > > exec { "sources": > > command => "sudo gem sources -a http://gems.github.com/ > > > /tmp/githubadded", > > creates => "/tmp/githubadded" > > } > > > > I hope that''s the right way to do it... > > > I would rather do: > > exec { "sources": > command => "sudo gem sources -a http://gems.github.com/", > unless => ''gem source -l | grep -q gems.github.com'', > } > > which is more idempotent. > > /tmp is thought only for temporary files. on the different systems this > file will be missing after a certain amount of time or after a reboot. > hence puppet would rerun the exec again.Also, if "gem sources -a" fails, it would not be retried until next /tmp cleanup. -- Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/ GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216 "Every program in development at MIT expands until it can read mail." -- Unknown --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---