puppet only exec when file does NOT exist
Solution 1:
Have you tried this?
onlyif => "test ! -f /usr/local/bin/papply"
Not sure if Puppet can use the '!' character
Perhaps a better alternaltive:
creates => '/usr/local/bin/papply'
even if i don't like the fact that the command doesn't really creates the file
Solution 2:
If you're on linux just do
unless => 'ls /somefile'
ls will return with a non-zero return code if the file does not exist and unless will only let the exec it is under execute if its test returns a non-zero return code.
Solution 3:
On linux and puppet >3.8 try:
exec { 'test':
command => '/bin/echo HI',
unless => 'test -f /a/file.txt',
}
exec will not run if /a/file.txt
exists.