Pete Emerson writes: > If you don't care about the contents of the file, just whether it's > there or not: > > unless => "/usr/bin/file MYFILE" > > or > > unless => "/usr/bin/stat MYFILE" > > or > > unless => "/bin/ls MYFILE" > > should all be pretty lightweight
Actually, if all "unless" looks at is the return code of the command I would probably go with unless => "test -e MYFILE" If you use "test" you could also do more sophisticated things like require the presence of a real file with "-f" and combine other tests for permissions or ownership. > On Thu, Mar 4, 2010 at 12:06 PM, Patrick <kc7...@gmail.com> wrote: > > > > On Mar 4, 2010, at 7:29 AM, Allan Marcus wrote: > > > >> 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:: > >> > >> exec { \"tar xf /my/tar/file.tar\": > >> cwd => \"/var/tmp\", > >> creates => \"/var/tmp/myfile\", > >> path => [\"/usr/bin\", \"/usr/sbin\"] > >> } > >> > >> > >> Is there a way to set the content of this file (/var/tmp/myfile) using > >> some additional parameter in the above syntax? > > > > This isn't the "right" way to do it, and you may have performance issues > > depending on the size of the file, but you can always combine grep with > > unless. > > > > If you want to re-extract the file if the file doesn't contain > > "testString" this should work. > > > > exec { "tar xf /my/tar/file.tar": > > cwd => "/var/tmp", > > creates => "/var/tmp/myfile", > > path => ["/usr/bin", "/usr/sbin"], > > unless => "grep testString myfile", > > } > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscr...@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-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@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-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.