Hi all,

I am using Puppet 3.6.2. I am trying to write a puppet module, which will 
replace a file with source template ONLY IF this file already exists. If 
this file doesn't exist, don't do anything. 

I have got it to work with the "exec" command, but that requires to use 
some command/script outside of Puppet. 
I want to find out if Puppet has any built-in function to achieve this 
purpose? 
I tried with "replace", but "replace" will create the file if the file 
doesn't exist. That's not I want.

Here is the example "exec" code:

  exec {'command when file exists':
    command         => "command to solve the problem",
    user            => root,
    onlyif          => "test -f /path/to/file",
    path            => ['/usr/bin','/usr/sbin','/bin','/sbin'],
    notify          => Notify['/path/to/file  found'],         
  }

  notify {'/path/to/file not found': }


Thanks a lot !

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/140e9878-cc03-4eb4-ac70-51282c358ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to