Puppet Testing if a file exist

The "native" way to do this without execs if you're on Puppet 2.6.6+:

file { '/path/to/myfile':
  ensure => 'present',
  audit  => 'all',
}

(This functionality exists since Puppet 2.6.0, but there were a number of issues with auditing that only really got hammered out with the 2.6.6 release.)

If you're on an older version, you can also tell the resource to run in noop mode, which will just display a message when Puppet is run and the file doesn't exist:

file { '/path/to/myfile':
  ensure => 'present',
  noop   => 'true',
}

You should create yours own function or use exec with onlyif command. something like :

exec { "mycommand":
  path => "/usr/bin:/usr/sbin:/bin",
  onlyif => "test -f /etc/blalba" //yours command 
}